home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 8 / Power CD-ROM 8.iso / prgmming / dbtalk / dbtalk.doc < prev    next >
Encoding:
Text File  |  1993-06-09  |  121.4 KB  |  4,748 lines

  1. @@Set-up
  2.  
  3. The Installation program should create a structure
  4. that looks like this :
  5.  
  6. DBTALK ---+----- BIN
  7.           |
  8.           +----- LIB
  9.           |
  10.           +----- RESOURCE
  11.           |
  12.           +----- SOURCE
  13.           |
  14.           +----- DEMO
  15.  
  16. The BIN subdirectory contains all EXE files and the
  17. run-time engines. It includes batch files (ED.BAT,
  18. COMP.BAT and MAKE.BAT) to use DBTALK for program
  19. compilation and resource linking. For Example :
  20.  
  21. ED laser.prg
  22.  
  23. ED laser.res
  24.  
  25. COMP laser
  26.  
  27. MAKE laser
  28.  
  29. The LIB subdirectory contains all external Classes and
  30. user-defined Classes.
  31.  
  32. The RESOURCE subdirectory contains all resources, SCN
  33. , VEW, ICN, FNT, PAL, ARR, BMP, VEC and TXT files.
  34.  
  35. The SOURCE subdirectory contains the source code for
  36. all applications.
  37.  
  38. The DEMO subdirectory is an example of an application
  39. subdirectory. Each DBTALK application should have a
  40. subdirectory in which it will run. It will contain the
  41. database files etc...
  42.  
  43. @@ SET variables
  44.  
  45. In order to use the system, three SET variables must
  46. be defined in your environment.
  47.  
  48. 1. You have to declare a DOS Set variable called
  49.     'PLL' which points to the   directory in which you
  50.     have installed DBTALK binary code. You can put the
  51.     SET statement into your AUTOEXEC.BAT file or any
  52.     BAT file you wish to use to activate DBTALK.
  53.  
  54.     For example :
  55.  
  56.     SET PLL=C:\DBTALK\BIN
  57.  
  58. 2. You have to include the DBTALK subdirectory in the
  59.     PATH statement of your AUTOEXEC file.
  60.  
  61.     For example :
  62.  
  63.     PATH C:\;C:\DOS;C:\DBTALK
  64.  
  65. 3. You have to declare a DOS Set variable called
  66.     'ADL' which points to the   directory in which you
  67.     have installed DBTALK resources. You can put the
  68.     SET statement into your AUTOEXEC.BAT file or any
  69.     BAT file you wish to use to activate DBTALK.
  70.  
  71.      For example :
  72.  
  73.      SET ADL=C:\DBTALK\RESOURCE
  74.  
  75. @@ Compiler
  76.  
  77. DB-TALK Resource Compiler
  78.  
  79. The DB-TALK resource compiler is the means of
  80. converting all the defined resources including the
  81. code into an EXE file.
  82.  
  83. To use the compiler type the following from your DOS
  84. prompt:
  85.  
  86. C:\DBTALK\DEMO> DBTALK <resource file> [switches]
  87.  
  88. <resource file> is the source file containing resource
  89. statements or program functions.
  90.  
  91. Although the file may contain both code and resource
  92. information, in order to generate different EXE files
  93. for different environments from the same code, it is
  94. recommended that source code should be put in '.PRG'
  95. files and resources into '.RES' files. By using the
  96. EXTERNAL resource directive and the /o switch,
  97. compiled code can be assembled into the EXE  over and
  98. over without re-compiling.
  99.  
  100. [switches] are as follows:
  101.  
  102. /O - Create an External reusable ADL file.
  103.  
  104. /A - Use Advanced run-time engine. This includes
  105.       Clipper GET and TBROWSE sub-systems.
  106.  
  107.      The default is the simpler GFORCE GET and BROWSE
  108.       functions. This run-time engine requires 50K
  109.       less of memory than the advanced run-time
  110.       engine.
  111.  
  112. /T - Use VGA font re-definition in text mode. This
  113.       gives the best memory usage at the expense of
  114.       VGA graphics. Most screen resources like buttons
  115.       and fonts are supported, but there is a 25-line
  116.       limitation and no graphic objects like bitmaps
  117.       and vector graphics. All new font files must be
  118.       cloned from the supplied files.
  119.  
  120. @@ Debugging
  121.  
  122. The SetTrace(<lOn/lOff) function can be used to set
  123. on/off TRACING and be used to trace specific programs
  124. sections during debugging.
  125.  
  126. Each generated Application creates a file called
  127. 'DBTALK.LOG' in the directory from where it is
  128. invoked. This file will contain any error messages
  129. that occur during the run.
  130.  
  131. In addition, valuable trace information will be
  132. written to this file when TRACING is set on.
  133.  
  134. A DOS set variable call ADLTRACE can be used for
  135. global tracing without    re-compiling the program.
  136. Just issue :
  137.  
  138.               C:\>SET adltrace=YES
  139.  
  140. to activate tracing and other value to disable.
  141.  
  142. To write to this file from an application, use
  143. function LOGF(cText). For example :
  144.  
  145.             LogF('The value of cName is '+cName)
  146.  
  147. There is a simple debugger for DBTALK with limited
  148. debugging facility available.
  149.  
  150. While tracing is on, pressing ALT D during a wait
  151. state to break into an application and invoke the
  152. debugger.
  153.  
  154. DBTALK will display the '>>' prompt on the message
  155. line (line 24). Any valid expression can be entered at
  156. this point. Variable values can be inspected and
  157. modified with care. In graphics mode, it might be
  158. preferable to write to the log file instead of the
  159. screen.
  160.  
  161. It is also invoked automatically when an error occurs
  162. and SETRACE is on.
  163.  
  164. Type EXIT or QUIT to exit the application.
  165.  
  166. Type RESUME to retry the error after a corection to
  167. resume normal processing.
  168.  
  169. @@Introduction
  170.  
  171. Introduction
  172.  
  173. It is a well known fact that more effort is spent on
  174. software maintenance, the process of modifying a
  175. system after it has been handed over to a customer
  176. than on the development of the software itself.
  177.  
  178. Many software developers know that what stops them
  179. from producing application systems as fast as Stephen
  180. King publishes novels is not their skills or the lack
  181. of it but the effort to maintain concurrently all
  182. versions of the applications they have already
  183. produced.
  184.  
  185. Here are some of the reasons why every software
  186. constructed goes through maintenance.
  187.  
  188. 1.The software developer may have made errors which
  189.    are only are discovered when the system is being
  190.    used by customer with real-life data.
  191.  
  192. 2.The customer's technology might have changed, for
  193.    example, new version of the operating system, or
  194.    the hardware may have been upgraded.
  195.  
  196. 3.The customer requirements for the software system
  197.    change over time even from the time the
  198.    specification is frozen.
  199.  
  200. It is the last reason of changes in requirements that
  201. is the most difficult to cope with. All developers
  202. know that users never know what they really want.
  203. Users often feel that their views and knowledge of
  204. their systems are changing as they learn and think
  205. more about it. As a result, they are usually half-way
  206. up a learning curve when the system's specifications
  207. are frozen.
  208.  
  209. Systems developed using structured ideas tend to
  210. behave badly with respect with to change. Make no
  211. mistake about it, structured systems when done
  212. properly have been shown to meet user's requirement.
  213. The problem is that the structure degrades as time
  214. goes by, and each further change take another bash at
  215. the structure of the system making it progressively
  216. more difficult to apply changes, soaking more and more
  217. skilled resource until the point comes when the
  218. software has to be replaced and the whole cycle starts
  219. all over again.
  220.  
  221. Object-oriented software development (OOD) techniques
  222. focus on the objects in the system. At the beginning
  223. of an OOD, an analyst will ask the customer what
  224. entities are important in the system to be developed.
  225.  
  226. For example, in an invoicing system two important
  227. entities are Customers and Invoices. After this the
  228. analyst will investigate what operations affect these
  229. entities. For example, a new Invoice will be created
  230. when a customer makes a purchase and deleted or
  231. archived when the customer fully pays up.
  232.  
  233. These entities are modelled into objects and then
  234. implemented in an object-oriented programming
  235. language. A number of these languages have been
  236. implemented to industry quality standards. Such
  237. languages enable a developer to define the data and
  238. operations that manipulate them and implement them
  239. using a facility known as a class. One of the most
  240. popular of the these languages is C++.
  241.  
  242. Early experience with such languages have shown that
  243. systems built with them tend to be much easier to
  244. maintain but not faster to develop the first time
  245. around. However they degrade at much slower rate than
  246. applications developed with a structured approach.
  247. Their selling point is that they offer a huge scope
  248. for software re-usability.
  249.  
  250. Most, if not all computer users, end users and
  251. programmers alike, are going to be affected by
  252. object-orientation over the next decade.  For the end
  253. user, this should make life easier, since it is via
  254. graphical user interfaces (GUIs) that they will
  255. encounter object-orientation.  The phenomenal success
  256. of Microsoft Windows 3.1 is an indication that this
  257. objective is already beginning to be realised.
  258.  
  259. For the programmer, life may be less simple, at least
  260. initially.  Object orientation requires a change of
  261. thinking for programmers familiar with procedural
  262. programming.  Since one of the main driving forces for
  263. the adoption of object-oriented programming will be
  264. the need to produce programs that run under the new
  265. graphical user interfaces, changing from procedural to
  266. object-oriented programming may involve changing not
  267. just the language being used, but the operating
  268. environment, resulting in an extremely steep learning
  269. curve.
  270.  
  271. For those lucky (or clever?) enough to be using the
  272. right languages, there is an alternative to the
  273. extreme course of learning a new language and
  274. operating environment at the same time: that is to
  275. begin using a 'hybrid' object oriented language, to
  276. familiarise oneself with the language aspects of
  277. object orientation, perhaps before it becomes
  278. necessary to change to a graphical environment as
  279. well.
  280.  
  281. C++ is a very good example of such a hybrid language.
  282. In the commercial world, C++ has become the de facto
  283. standard for object oriented languages largely because
  284. of its roots in the C language, which make it
  285. accessible to the enormous body of existing C
  286. programmers.  Hybrid object oriented languages
  287. typically allow a mix of procedural and object
  288. oriented code to coexist in the same program, so that
  289. developers are not forced to rewrite systems, but can
  290. take advantage of object orientation incrementally.
  291.  
  292. DB-TALK makes Clipper a Hybrid object oriented
  293. language allowing a mix of 3GL procedural code  of the
  294. basic Clipper language, the object orientation of
  295. Class(y).lib, the Graphical User Interface of Gforce
  296. and the 4GL facilities of the ADL Class library.
  297.  
  298. Class(y) is an add-on library for Clipper which
  299. extends the language by providing the ability to
  300. create and manipulate new classes, thereby making
  301. Clipper the latest entry into the select group of
  302. hybrid object oriented languages.
  303.  
  304. Gforce is an add-on library for Clipper which gives
  305. Clipper language complete control over VGA graphics.
  306.  
  307. ADL Class library provides the Clipper language with a
  308. simple GUI in DOS. It also provides 4GL facilities
  309. through abstraction that enable separation of design
  310. and implementation issues of  application development.
  311.  
  312. DB-TALK has an advantage over Clipper that it is an
  313. interpreter and design objects do not have to be coded
  314. or converted into code but can be created by various
  315. visual design tools and stored as resources with code
  316. providing more flexibility.
  317.  
  318. This document will give a brief overview of object
  319. orientation, and define most of the important terms,
  320. as a prelude to a tutorial-style introduction of the
  321. use of DB-TALK
  322.  
  323. @@ History
  324.  
  325. History of Object-Oriented Languages
  326.  
  327. The concept of an object class and inheritance,
  328. central to object oriented languages, was first
  329. implemented in the language Simula in the 1960s.
  330. Simula, as its name implies, was intended as a
  331. language for programming simulations, and never really
  332. entered the mainstream.
  333.  
  334. The major milestone in the development of object
  335. oriented languages was the Smalltalk research project
  336. at Xerox Palo Alto Research Centre (PARC). Starting in
  337. the early 1970s, the Smalltalk project, initiated by
  338. Alan Kay, had as its goals more than just the
  339. development of a programming language; rather, a
  340. complete integrated environment was the goal,
  341. including an object-oriented language, development
  342. tools, and a graphical interface. The standard
  343. components of modern graphical interfaces, such as
  344. windows, icons, and the mouse, were pioneered at Xerox
  345. PARC.
  346.  
  347. The Smalltalk language itself was the first 'true'
  348. object oriented language in that it dealt exclusively
  349. with objects.  All subsequent object oriented
  350. languages have been based on the concepts used in
  351. Smalltalk.
  352.  
  353. Smalltalk was important, not just for its language,
  354. but for the development tools available in the
  355. Smalltalk environment.  These include class browsers
  356. and object inspectors.  A class browser is a very
  357. powerful tool which allows program code to be edited
  358. in a much more convenient and structured way than with
  359. conventional editors.  Because of the inherently
  360. well-defined structure of object oriented programs,
  361. the class browser is capable of displaying a given
  362. program's class tree in graphical form, allowing the
  363. user to 'point and shoot' to select a particular
  364. method (procedure) to be edited.  Many programming
  365. tasks become menu driven, such as the creation of new
  366. classes, modifying the structure of the class tree,
  367. and modifying the structure of a class.  These
  368. operations are far more complex if performed in a
  369. traditional editing environment.
  370.  
  371. Tools such as these are an integral part of the
  372. promise of object oriented technology.  They can
  373. simplify a programmer's life, reducing development
  374. time and costs.  Although they are a rarity in the DOS
  375. world at present, as the move toward object oriented
  376. technology grows, they will become more commonplace.
  377.  
  378. @@ Object?
  379.  
  380. What is an Object
  381.  
  382. One of the fundamental reasons that object orientation
  383. is enjoying such success as a programming paradigm is
  384. very simple: the real world is made up of objects.  An
  385. invoice is an object.  A stock item is an object.  A
  386. balance sheet is an object.  An entire company is an
  387. object.  Objects can contain other objects; and in
  388. this way complete systems can be constructed using
  389. objects.
  390.  
  391. But what is an object from a programming point of
  392. view?  Simply put, it is a collection, or module,
  393. containing both procedures and data.  This is not very
  394. enlightening in itself; but before we can explain it
  395. better, we need to explore some other concepts.
  396.  
  397. @@ Class
  398.  
  399. Classes, Instances and Instance Variables
  400.  
  401. In any given system, many objects will exist.  Some of
  402. these objects will be very similar: for example, you
  403. might have thousands of invoice objects stored on
  404. disk.  Although each one is different, they all share
  405. a common set of attributes.  The same operations are
  406. valid on all of them.  A 'class' consists of
  407. procedures and data which are common to all the
  408. objects
  409. which are members of that class.  An invoice class
  410. would contain the procedures for printing invoices,
  411. for example.
  412.  
  413. To summarise, then, we can define the term 'object' in
  414. another way: an object is an 'instance' of a class.  A
  415. given class may have many instances of itself
  416. (objects) in existence at any one time.  Each of these
  417. instances has the same basic structure as its parent
  418. class, but they are distinguished from each other by
  419. the data contained within them, which is stored in
  420. 'instance variables'.
  421.  
  422. These instance variables, like any other variables,
  423. have names. An invoice object might contain instance
  424. variables such as 'date', 'customer', and 'amount'.
  425. These instance variables are not normally accessible
  426. outside of the object; as described below, they are
  427. only accessed via that object's methods.
  428.  
  429. @@ Methods
  430.  
  431. Messages and Methods
  432.  
  433. We defined an object, earlier, as a module containing
  434. both procedures and data.  An object's procedures are
  435. known as 'methods'.  This terminology helps to
  436. distinguish them from procedures which are not
  437. associated with an object, since there are fundamental
  438. differences.  In a fully object oriented system such
  439. as Smalltalk, there are no procedures, only methods.
  440. In a hybrid system such as C++, or DB-TALK, both
  441. methods and procedures can coexist.
  442.  
  443. Methods are not called in the same way that procedures
  444. are.  Rather, 'messages' are sent to objects, which
  445. respond by executing the appropriate method.  All
  446. valid operations on or using the data in an object are
  447. defined by its methods, so all operations on an object
  448. are accomplished by sending messages to the object.
  449. Because of this, it is not necessary for other objects
  450. to access, or even know about, the internals of
  451. foreign objects. Objects behave like black boxes: send
  452. them a message, and they respond by executing the
  453. appropriate method.  Send the 'print' message to an
  454. invoice object, and it will respond by printing
  455. itself.  This black box approach is known generally as
  456. 'encapsulation', and while it is possible to achieve
  457. in procedural systems, object oriented systems
  458. actively encourage, support and enforce it.
  459.  
  460. @@ Inheritance
  461.  
  462. Inheritance: Superclasses and Subclasses
  463.  
  464. Common properties among groups of classes can often be
  465. combined to form a 'parent class', or 'superclass'.
  466. For example, it would make sense for a quotation
  467. class, an order class, and an invoice class all to
  468. share the same superclass, a sales document class.
  469. The quotation, order, and invoice classes are then all
  470. 'subclasses' of the sales document class.  This is
  471. known as 'inheritance'.  The subclasses have inherited
  472. all the properties of their superclass, and may add
  473. unique, individual properties of their own.  This
  474. concept can be extended further, with subclasses of
  475. subclasses. Class trees seven or more levels deep are
  476. very common in object oriented systems.
  477.  
  478. This is one of the most powerful features of object
  479. oriented programming, since it allows reuse of
  480. existing code in new situations without modification.
  481. When a subclass is derived from a superclass, only the
  482. differences in behaviour need to be programmed into
  483. the subclass.  The superclass remains intact and might
  484. continue to be used as is in other applications, where
  485. other subclasses are using it in different ways.
  486.  
  487. @@ Polymorphism
  488.  
  489. Polymorphism
  490.  
  491. This is not a new concept, just a new term.  It refers
  492. to the fact that the same message, such as 'print',
  493. can result in different behaviours when sent to
  494. different objects.  Sending the print message to a
  495. graph object has a very different effect than on a
  496. balance sheet object.  Polymorphism has benefits for
  497. the programmer in that consistent names are used, but
  498. its implications go deeper than that.  It means that a
  499. message can be sent to an object whose class is not
  500. known.  In a procedural system, given a variable of
  501. unknown type, a case statement would typically be
  502. required to test the type of the variable and pass it
  503. to the correct procedure for the desired operation.
  504. In an object oriented system, a message is sent to the
  505. object with no testing, and the object responds
  506. accordingly.
  507.  
  508. @@Overview
  509.  
  510. Overview of DBTALK
  511.  
  512. DB-TALK extends the Clipper language by providing the
  513. ability to create and use user-defined object classes,
  514. allowing fully object-oriented programs to be
  515. written.  It provides all the key features of an
  516. object oriented language, including inheritance, with
  517. the consistent simplicity of Smalltalk, the real-world
  518. practicality of C++, and the database power of
  519. Clipper.
  520.  
  521. DB-TALK consists of a Resource Compiler, Visual tools
  522. for GUI screens, Database Views, Columnnar Reports,
  523. Graphics Bitmaps, Icons and fonts. Object oriented
  524. Clipper programs can be written and compiled into
  525. codeblocks in conjunction with other resources, then
  526. linked with the ADL Class library to form an EXE file.
  527.  
  528. DB-TALK makes use of, and extends, Clipper's limited
  529. built-in object oriented capabilities, specifically
  530. the send operator, or colon.  In Clipper, a message is
  531. sent to an object as follows:
  532.  
  533.     object:message(parameters)
  534.  
  535. DB-TALK slightly changes this syntax. In DB-TALK, a
  536. message is sent to an object as follows:
  537.  
  538.     object:Send('message', parameters)
  539.  
  540. With DB-TALK, it is possible to mix and match
  541. programming styles.  On the one hand, object classes
  542. can be developed and used in normal procedural
  543. programs, in the same way that the built-in TBrowse
  544. and Get classes are used in Clipper.
  545.  
  546. At the other extreme, complete object oriented systems
  547. can be developed, in which no stand alone procedures
  548. exist, other than a startup procedure 'Main'.  The
  549. startup procedure initialises the system and from then
  550. on, all program execution is effected by passing
  551. messages between objects.
  552.  
  553. Any desired mix of these two approaches may be used,
  554. allowing developers to gradually familiarise
  555. themselves with the benefits of object-oriented
  556. programming.
  557.  
  558. The following sections form a tutorial for creating
  559. and using user defined object classes.
  560.  
  561. @@ Create Class
  562.  
  563. Creating a Class
  564.  
  565. Perhaps the most fundamental feature required of an
  566. object oriented programming language is the ability to
  567. create new object classes.  Although standard Clipper
  568. does not provide this capability, DB-TALK provides the
  569. means to do this.  In DB-TALK a class consists of a
  570. class specification, which describes the overall
  571. structure of a class, and the class implementation,
  572. which contains the actual code for the methods of that
  573. class.
  574.  
  575. To illustrate the creation of a class, we will use as
  576. a rectangle class as a simple example.  Here is the
  577. class specification:
  578.  
  579. * rectangle.prg
  580.  
  581. #define TOP    1
  582. #define LEFT   2
  583. #define BOTTOM 3
  584. #define RIGHT  4
  585.  
  586. CLASS REC
  587.  
  588.   METHOD width
  589.     LOCAL x:=self:set()
  590.   RETURN x[RIGHT] -  x[LEFT] + 1
  591.  
  592.   METHOD height
  593.     LOCAL x:=self:set()
  594.   RETURN x[BOTTOM] - x[TOP] + 1
  595.  
  596.   METHOD area
  597.     LOCAL nArea
  598.     nArea = self:Send('Width') * self:Send('Height')
  599.     self:private(nArea)
  600.   RETURN nArea
  601.  
  602.   METHOD NewPos
  603.     PARAMETER nTop, nLeft, nBottom, nRight
  604.     nTop =    MAX (1, nTop)
  605.     nLeft =   MAX (1, nLeft)
  606.     nBottom = MIN (maxrow(), nBottom)
  607.     nRight  = MIN (maxcol(), nRight)
  608.     self:Set( {nTop, nLeft, nBottom, nRight} )
  609.   RETURN
  610.  
  611. END CLASS
  612.  
  613.  
  614.  
  615. DB-TALK classes are identified by a three character
  616. identifier which becomes a prefix on all the names of
  617. methods belonging to the class.
  618.  
  619. The first statement, CLASS, is straightforward.  We
  620. are creating a class identified by REC. All following
  621. statements up to the END CLASS statement should be
  622. DB-TALK Method definitions of class REC.
  623.  
  624. DB-TALK does not have instance variables, rather each
  625. object has instance values held in a private and a
  626. public data structure (arrays) which are accessed by
  627. special methods 'private' and 'set' respectfully. How
  628. this works will be more clearer when we use the REC
  629. class we have declared.
  630.  
  631. Using the Class
  632.  
  633. Before we cover the actual implementation of the
  634. class, we will look at how the class would be used.
  635.  
  636. * testrect.prg
  637.  
  638. PROCEDURE main
  639.  
  640.     PRIVATE oRect
  641.  
  642.     oRect := ADLClass('REC', {5,10,15,40})
  643.  
  644.     qout( 'The dimensions of Rectangle oRect are as
  645. follows:')
  646.  
  647.     qout( '      width:', oRect:send('width'))
  648.     qout( '     height:', oRect:send('height'))
  649.     qout( '       area:', oRect:private())
  650.  
  651. RETURN
  652.  
  653. * eof testrect.prg
  654.  
  655. This program creates a new instance of the class
  656. Rectangle and assigns it to the local variable
  657. 'oRect'.  The statement:
  658.  
  659.     oRect := ADLClass('REC',aInCoord)
  660.  
  661. can be understood as sending the 'REC' message to the
  662. ADL Class maker class, which has the effect of
  663. creating an instance of the REC class with the
  664. specified dimensions.
  665.  
  666. The second parameter to the ADLClass is the object's
  667. public data structure and is used to set the
  668. dimensions of the Rectangle.  What the contents of
  669. this array should be depends on what instance values
  670. are need by the class.
  671.  
  672. Once we have created our object, we can use it just as
  673. we would any other Clipper object, by sending it
  674. messages.
  675.  
  676. The statement oRect:Send('width'), for example, sends
  677. the width message to the Rectangle oRect.  In this
  678. particular case, this has the effect of invoking the
  679. width method, which calculates
  680. and returns a result.
  681.  
  682. Running this program produces the following output:
  683.  
  684.     C:\>testrect
  685.  
  686.     The dimensions of Rectangle x are as follows:
  687.           width:         31
  688.           height:        11
  689.           area:         341
  690.  
  691. Error 0 Private Scope Violation for PRG at line 20 in
  692. PRGmain
  693. Operation :
  694. Called from ABORT Line: 129
  695. Called from obj:PRIVATE Line: 68
  696. Called from (b)STRTOARR Line: 0
  697. Called from obj:SENDIT Line: 383
  698. Called from obj:ADLOBJSEND Line: 210
  699. Called from ADLQE Line: 61
  700.  
  701. We have an error.  Looking at line 20 of TESTRECT.PRG,
  702. we see that we have tried to print the value of the
  703. rectangle area instance value which was put in the
  704. private data structure.  What is wrong with that?.
  705. Private instance values accessed through the 'Private'
  706. method can only be accessed by methods belonging to
  707. class Rectangle.  Our program, TESTRECT.PRG, is not a
  708. Rectangle method, and so is prevented from accessing
  709. this method.
  710.  
  711. Private instance values are one of the fundamental
  712. benefits of object oriented programming.  By making an
  713. instance value private, we ensure that only a
  714. relatively small set of routines (the methods of that
  715. class) can change that variable.  If the variable's
  716. value is incorrect, we know exactly which routines to
  717. examine.
  718.  
  719. It is considered bad object oriented practice to allow
  720. instance values to be changed outside of their class.
  721. However, it is often necessary, and acceptable, to
  722. obtain, but not set, an instance value outside of the
  723. class.  To facilitate this, a method can be defined to
  724. access the value.
  725.  
  726. Class Implementation
  727.  
  728. The class implementation consists of code for all the
  729. methods specified for that class.  This code is
  730. usually placed in a different file from the class
  731. specification.
  732.  
  733. When writing methods, you need to be aware of how a
  734. method differs from a normal function or procedure.  A
  735. method, unlike a normal function or procedure, is not
  736. called directly, but rather is invoked as the result
  737. of a message sent to an object.  A method cannot be
  738. called with no object.  A method acts on the object
  739. receiving the message; but to do so, it needs to be
  740. able to access it.  To this end, the variable 'self'
  741. exists in all methods, and it refers to the object
  742. which received the message that is being acted on.
  743. Instance variables and methods belonging to that
  744. object are accessed via the 'self' variable.  In the
  745. WIDTH method in the code above, for example, the line:
  746.  
  747.     x = self:Set()
  748.  
  749. assigns the public instance values of the rectangle
  750. receiving the WIDTH message.
  751.  
  752. The code of the methods is mostly self-explanatory.  A
  753. new keywords are used: METHOD.
  754.  
  755. The METHOD keyword is used when declaring a procedure
  756. or function, as can be seen above.  All methods should
  757. be declared in this way.
  758.  
  759. Now that we have finished with RECTANGLE.PRG, we have
  760. the makings of a complete system and can actually test
  761. it.  The system can be compiled as follows:
  762.  
  763.     dbtalk rectangle.prg /o
  764.     dbtalk testrect.prg
  765.  
  766. This should create the file TESTRECT.EXE which can
  767. then be run.  Note that the /o switch is used to
  768. create RECTANGLE.ADL which is declared external in
  769. TESTRECT.
  770.  
  771. @@ Inheritance
  772.  
  773. Inheritance
  774.  
  775. An object oriented language is not complete if it does
  776. not support inheritance.  Inheritance is the mechanism
  777. which allows existing code to be reused in different
  778. circumstances without modification.
  779.  
  780. As an example, we will declare a class called
  781. ScreenRect which can draw a rectangle on the screen
  782. and manipulate it.  Since we already have a rectangle
  783. class, we can save a lot of time by inheriting from
  784. that class.
  785.  
  786. The code below defines the class ScreenRect.  A new
  787. feature which has been used here should be explained
  788. in advance, because of it's ubiquity.  The double
  789. colon (::) is a shorthand notation for sending a
  790. message to the self object in a method.  This is
  791. particularly useful in a statement such as the
  792. following:
  793.  
  794. self:Send('hide')
  795.  
  796. With the double colon, this becomes:
  797.  
  798. ::Hide
  799.  
  800. which might look strange at first, but once you are
  801. used to it, is easier to read than the alternative.
  802.  
  803. Here is the code for the ScreenRect class:
  804.  
  805. *  scrnrect.prg
  806.  
  807. CLASS SRT
  808.  
  809. INHERIT RECTANGLE
  810.  
  811.     METHOD hide
  812.       LOCAL aScrnRect:=self:Set()
  813.       LOCAL nTop:=aScrnRect[1], nLeft:=aScrnRect[2]
  814.       LOCAL nBottom:=aScrnRect[3],
  815. nRight:=aScrnRect[4]
  816.       restscreen(nTop, nLeft, nBottom, nRight,
  817. self:Private())
  818.     RETURN
  819.  
  820.     METHOD show
  821.       LOCAL cScreenBuf, aScrnRect:=self:Set()
  822.       LOCAL nTop:=aScrnRect[1], nLeft:=aScrnRect[2]
  823.       LOCAL nBottom:=aScrnRect[3],
  824. nRight:=aScrnRect[4]
  825.       LOCAL cColor:=aScrnRect[5],
  826. nBoxStyle:=aScrnRect[6]
  827.       cScreenBuf := savescreen(nTop, nLeft, nBottom,
  828. nRight)
  829.       dispbox(nTop, nLeft, nBottom, nRight, nBoxStyle,
  830. cColor)
  831.       self:Private(cScreenBuf)
  832.     RETURN
  833.  
  834.     METHOD MoveUp
  835.       PARAMETER n
  836.       LOCAL aScrnRect:=self:Set()
  837.       LOCAL nTop:=aScrnRect[1], nLeft:=aScrnRect[2]
  838.       LOCAL nBottom:=aScrnRect[3],
  839. nRight:=aScrnRect[4]
  840.       ::hide
  841.       ::NewPos(nTop - n, nLeft, nBottom - n, nRight)
  842.       ::show
  843.     RETURN
  844.  
  845.     METHOD MoveDown
  846.       PARAMETER n
  847.       LOCAL aScrnRect:=self:Set()
  848.       LOCAL nTop:=aScrnRect[1], nLeft:=aScrnRect[2]
  849.       LOCAL nBottom:=aScrnRect[3],
  850. nRight:=aScrnRect[4]
  851.       ::hide
  852.       ::NewPos(nTop + n, nLeft, nBottom + n, nRight)
  853.       ::show
  854.     RETURN
  855.  
  856.     METHOD MoveLeft
  857.       PARAMETER n
  858.       LOCAL aScrnRect:=self:Set()
  859.       LOCAL nTop:=aScrnRect[1], nLeft:=aScrnRect[2]
  860.       LOCAL nBottom:=aScrnRect[3],
  861. nRight:=aScrnRect[4]
  862.       ::hide
  863.       ::NewPos(nTop, nLeft - n, nBottom, nRight - n)
  864.       ::show
  865.     RETURN
  866.  
  867.     METHOD MoveRight
  868.       PARAMETER n
  869.       LOCAL aScrnRect:=self:Set()
  870.       LOCAL nTop:=aScrnRect[1], nLeft:=aScrnRect[2]
  871.       LOCAL nBottom:=aScrnRect[3],
  872. nRight:=aScrnRect[4]
  873.       ::hide
  874.       ::NewPos(nTop, nLeft + n, nBottom, nRight + n)
  875.       ::show
  876.     RETURN
  877.  
  878. * eof scrnrect.prg
  879.  
  880. A number of new techniques have been used in this
  881. example above.  First and most important is
  882. inheritance.  The ScreenRect class has been declared
  883. by inheriting from the Rectangle class, using the
  884. statement:
  885.  
  886.     INHERIT Rectangle
  887.  
  888. This means that the ScreenRect class inherits all of
  889. the instance values and methods of the Rectangle
  890. class, in addition to its own instance values and
  891. methods.  In the 'hide' method, for example, the
  892. instance values for nTop, nLeft, nBottom, and nRight,
  893. which are Rectangle instance value, have been
  894. accessed, along with 'screenBuf', which is a
  895. ScreenRect instance value.
  896.  
  897. Inheriting from another class raises an issue with
  898. regard to the
  899. data structure of the parent class, or 'superclass',
  900. should strictly speaking also be initialised when the
  901. object is created.  As the superclass should have its
  902. own data structure, it makes sense to intialise it.
  903. DB-TALK automates this process, by allowing the
  904. combined data structure to be intialised when the
  905. objects are created. In the example below, the line:
  906.  
  907.     LOCAL rect1 := ADLClass('SRT', {5, 5, 10, 25,
  908. 'R+/BG', 1} )
  909.  
  910. declares a screen rectangle object with a data
  911. structure of 6 instance values. The first four belong
  912. to the RECTANGLE class while the last 2 are for the
  913. SCREENRECT class. The data structure passed as a
  914. parameter should of course, correspond with the data
  915. structure expected by the superclass methods in this
  916. case that of the class Rectangle.
  917.  
  918. Below is a sample program to use the SCREENRECT class.
  919.  
  920. * testscrn.prg
  921.  
  922. EXTERNAL scrnrect
  923.  
  924. FUNCTION main
  925.     LOCAL i:=1
  926.     LOCAL rect1 := ADLClass('SRT', {5, 5, 10, 25,
  927. 'R+/BG', 1} )
  928.     LOCAL rect2 := ADLClass('SRT', {15, 60, 22, 75,
  929. 'R+/BG', 2})
  930.  
  931.     DO WHILE ! i > 10
  932.        rect1:Send('MoveDown', 1)
  933.        rect1:Send('MoveRight', 1)
  934.        rect2:Send('MoveUp', 1)
  935.        rect2:Send('MoveLeft', 1)
  936.        i = i + 1
  937.     ENDDO
  938.  
  939. RETURN
  940.  
  941. * eof testscrn.prg
  942.  
  943. This sample program will allow us to test the
  944. ScreenRect class.  Compile as follows:
  945.  
  946.     dbtalk rectangl.prg /o
  947.     dbtalk scrnrect.prg /o
  948.     dbtalk testscrn.prg
  949.  
  950. Note that the RECTANGLE program is compiled as object
  951. files to be linked in SCRNRECT.  If it is not
  952. pre-compiled, a compilation error will occur regarding
  953. an external symbol RECTANGLE. The same thing applies
  954. to SCRNRECT with TESTSCRN.
  955.  
  956. You can now run TESTSCRN.EXE.
  957.  
  958. @@ADL Class Lib
  959.  
  960. ADL Class Library
  961.  
  962. It is now apparent that to make the shift to OOP
  963. (Object-oriented programming) requires a significant
  964. up-front investment of effort to create a foundation
  965. of reusable code upon which to build applications.
  966. Essential for maximum productivity, this foundation
  967. must be comprised of a least the classes of objects
  968. needed for everyday programming, such as classes for
  969. the user-interface, the database and report writing.
  970. Adding a GUI (Graphical user Interface) and event
  971. driven programming on top, this becomes a most
  972. daunting task.
  973.  
  974. DB-TALK makes this an easy task by providing you with
  975. a basic class library to handle the GUI, the database
  976. and reports leaving you free to concentrate on
  977. creating application classes which deal with the
  978. functional issues of your application. DB-TALK also
  979. provides visual tools that simplify greatly the task
  980. of specifying the objects for each class supported.
  981.  
  982. DB-TALK is supplied with 9 pre-defined classes.
  983. DB-TALK pre-defined classes are of two types.
  984.  
  985. The first type are known as the Built-in classes. The
  986. methods for these classes are compiled and are part of
  987. the DB-TALK run-time which is automatically linked
  988. into all compiled programs.
  989.  
  990. The second type are known as the External classes. The
  991. methods for these classes are compiled into object
  992. files and have to be included manually into each
  993. application that requires them.
  994.  
  995. The decision to make a class built-in or external was
  996. dependent on a balance between speed and size.
  997.  
  998. Builtin Classes
  999.  
  1000. There are two types of built-in classes. Those that
  1001. are system declared and those that are user-declared.
  1002. Generally, DB-TALK creates objects of the system
  1003. declared classes, while the user creates objects of
  1004. the user-declared classes. In some cases, developers
  1005. may need to reference system objects created on their
  1006. behalf.
  1007.  
  1008. For example, the 'PRG' class is system declared. It is
  1009. the default class. All DB-TALK functions and
  1010. procedures without a CLASS identifier (non methods)
  1011. are compiled into methods of this class. When a
  1012. compiled DB-TALK application starts, a 'PRG' object is
  1013. created. DB-TALK then passes this object the message
  1014. 'Main'. What happens after that depends on what the
  1015. developer has coded into 'Main'.
  1016.  
  1017. Even though the developer has not created this 'PRG'
  1018. object, in order to call another function or procedure
  1019. within the same class (application), this object has
  1020. to be referenced through the self identifier.
  1021.  
  1022. User-defined classes are explicitly declared by the
  1023. developer. Objects of these classes should be treated
  1024. like normal variables. The scope and life of these
  1025. objects should always be considered.
  1026.  
  1027. @@ SCN Class
  1028.  
  1029. SCN Class (User defined)
  1030.  
  1031. The Screen Class allows the design of screens, a
  1032. DB-TALK version of GUI forms/dialog boxes. GUI forms
  1033. are attractive windows designed for entering and
  1034. displaying data. They employ a number of
  1035. user-interface controls, such as text boxes, push
  1036. buttons, radio buttons, and listboxes to handle
  1037. interaction with the user.
  1038.  
  1039. DB-TALK also provides a screen editor which simplifies
  1040. the task of specifying these controls. For example :
  1041.  
  1042. SCREEN laserscr
  1043. ....
  1044. .....
  1045. oLaserScn = ADLClass ('SCN', laserscr)
  1046.  
  1047. The first statement causes the DB-TALK resource
  1048. compiler to include as a resource in the current
  1049. compilation the screen design found in file
  1050. 'laserscr.scn'. This specification is the data
  1051. structure of an SCN class object.
  1052.  
  1053. The second statement executed at run-time causes an a
  1054. SCN object oLaserScn to be created. This object will
  1055. respond to normal SCN messages 'Display', 'Read',
  1056. 'Clear' etc.
  1057.  
  1058. @@ FLD Class
  1059.  
  1060. FLD Class (System defined)
  1061.  
  1062. Even though the developer declares the whole screen
  1063. including its controls as a SCN object, DB-TALK
  1064. generates internally, a FLD object for each control.
  1065. The developer does not need to know of their
  1066. existence. However when the need arises to do
  1067. something to a user control in isolation of the
  1068. others, its object can be requested for an used. For
  1069. example, using our SCN object above :
  1070.  
  1071. oLaserScn = ADLClass ('SCN', laserscr)
  1072. oDesc = oLaserScn:Send('Object', 'DESC')
  1073. oDesc:Send('Refresh')
  1074.  
  1075. the SCN object oLaserScn is told to return the FLD
  1076. object of a textbox called 'DESC'. The oDesc FLD
  1077. object will respond to normal FLD messages 'Refresh',
  1078. 'Edit', etc.
  1079.  
  1080. @@ PRG Class
  1081.  
  1082. PRG Class (System defined)
  1083.  
  1084. As mentioned earlier, the PRG class is used by DB-TALK
  1085. and only one instance of exists throughout the
  1086. application. Its purpose is to interpret all free
  1087. standing functions and procedures that do not belong
  1088. to any user-defined class. It is through this class,
  1089. that a developer can mix procedural and
  1090. object-oriented programming.
  1091.  
  1092. To code DB-TALK programs procedurally, a developer can
  1093. display a screen and use a read loop to accept all
  1094. events on the screen until an exit event is received.
  1095. Within the loop, a CASE structure can be used to
  1096. handle the expected messages in a structured way.
  1097.  
  1098. On the other hand, an event-driven approach can be
  1099. adopted. Like the procedural approach, a developer can
  1100. display a screen and use a read loop to accept all
  1101. events on the screen until an exit event is received.
  1102. However, this is where the similarity ends. Instead of
  1103. using a CASE structure, a hierarchy of event handlers
  1104. are used to handle the expected events. The handler at
  1105. the top of the hierarchy is the system handler which
  1106. receives all events. If the event is not handled at
  1107. system level it is passed to the screen handler. If
  1108. the screen handler does not reecognise it, then it is
  1109. finally passed to the application which has to deal
  1110. with it.
  1111.  
  1112. The difference between the two is that the procedural
  1113. approach is fixed in how a user can use the
  1114. application, while the event-driven approach will
  1115. allow the user flexibility in use.
  1116.  
  1117. @@ DBF Class
  1118.  
  1119. DBF Class (User defined)
  1120.  
  1121. A database is a collection of related tables. DBF
  1122. files are in fact tables. DB-TALK provides a DBF class
  1123. to define database views. A database view is a subset
  1124. of a complete database. It hold a subset of the
  1125. tables, relationship rules about the tables and only
  1126. the fields of each table needed to support a complete
  1127. interaction of the user with a Screen.
  1128.  
  1129. DB-TALK supplies a Database View editor which can be
  1130. used to create and modify DBF files, Index files and
  1131. DBF relationships. It can also be used to populate the
  1132. DBF files with data manually or from a wide variety of
  1133. sources.
  1134.  
  1135. To use the DBF class is as straight foreword as
  1136. writing normal Clipper DML (data manipulation
  1137. language). For example :
  1138.  
  1139. DATABASE  invoice
  1140. ...
  1141. ...
  1142. oLaserDbf = ADLClass ('DBF', invoice)
  1143. oLaserDbf:Send('Open')
  1144. oLaserDbf:Send('Read', 'INVOICE')
  1145.  
  1146. This translates into normal xBase as:
  1147.  
  1148. SELECT 0
  1149. USE CUSTOMER
  1150. SET INDEX to CUSTOMER
  1151.  
  1152. SELECT 0
  1153. USE INVOICE
  1154. SET INDEX to INVOICE
  1155. SET RELATION TO cust_code INTO CUSTOMER
  1156.  
  1157. SELECT 0
  1158. USE INVOICELIN
  1159. SET INDEX TO INVOICELIN
  1160. SET RELATION to inv_no INTO INVOICE
  1161.  
  1162. m->inv_no   = invoice->inv_no
  1163. m->inv_desc = invoice->inv_desc
  1164. ......
  1165. ......
  1166.  
  1167. @@ REP Class
  1168.  
  1169. REP Class (User defined)
  1170.  
  1171. DB-TALK columnar reports are simply standard dBASE III
  1172. reports.  DB-TALK through OOPS gives more flexibity in
  1173. programming reports. There are simply three methods to
  1174. use. The first one called at the beginning of the
  1175. report initialises the report and prints the headings.
  1176. The second one is called to print each detail line and
  1177. group totals generated. The last one terminates the
  1178. report printing the final totals.
  1179.  
  1180. DB-TALK provides a report designer tool that enables a
  1181. developer to set-up the  report layout. DB-TALK
  1182. provides flexibility in the printing as the developer
  1183. should provide a device object which will respond to
  1184. three messages issued by the report writer.
  1185.  
  1186. This is a classic example of polymorphism as the
  1187. report writer does not know which device it is
  1188. printing to. It could be a printer, disk file Word
  1189. processor file or even a fax.
  1190. Any device object could be used provided it responds
  1191. to the messages it receives. For example :
  1192.  
  1193.     REPORT laserrep
  1194.     .....
  1195.     .....
  1196.     oLaserRep:=   ADLClass('REP', laserrep)
  1197.     oLaserWp:=    ADLClass('WP', {'WP', 'laser.doc',
  1198. ''} )
  1199.     oLaserTxt:=   ADLClass('TXT', 'laser.doc')
  1200.  
  1201.    IF YESNOBOX('Selection',' WordPerfect or DOS text')
  1202.       oLaserPrn = oLaserWp
  1203.    ELSE
  1204.       oLaserPrn = oLaserTxt
  1205.    ENDIF
  1206.  
  1207.     oLaserPrn:Send('Open')
  1208.     oLaserRep:Send('Initiate', oLaserPrn, '')
  1209.     oDbView:Send('Gotop','LASER')
  1210.  
  1211.    DO WHILE ! oDbView:Send('eof', 'LASER')
  1212.  
  1213.        oLaserRep:Send('Generate')
  1214.        oDbView:Send('skip','LASER',1)
  1215.    ENDDO
  1216.  
  1217.     oLaserRep:Send('Terminate')
  1218.     oLaserPrn:Send('Close')
  1219.     oDbView:Send('Gotop','LASER')
  1220.  
  1221. @@ WP Class
  1222.  
  1223. WP  Class (User defined)
  1224.  
  1225. DB-TALK has no built-in print drivers. Instead it uses
  1226. word processor documents as its printing protocol.
  1227. DB-Talk supports Word Perfect,  Lotus Manuscript and
  1228. Lotus 1-2-3 formats. It uses this WP class to hides
  1229. all complications and codes needed to create a WP
  1230. document. Once a document object is created, data is
  1231. sent to the object via different messages. The object
  1232. deals with all internal rules of the different formats
  1233. and maintains a truly Word Perfect, 1-2-3 or
  1234. Manuscript compatible file.
  1235. On a network, this enables Word Perfect, 1-2-3 or
  1236. Manuscript to be used as a print server for DB-TALK
  1237. applications.
  1238.  
  1239. With Manuscript objects, a new document can be made
  1240. from an existing template. Also, various markers can
  1241. be inserted included PIC files generated from the
  1242. CHART class. For example :
  1243.  
  1244. oLaserWp:= ADLClass('WP', {'MS', 'laser.doc',
  1245. 'laser.set'} )
  1246. oLaserWp:Send('Open')
  1247. oLaserWp:Send('Addline', 'Below is a chart of
  1248. categories')
  1249. oLaserWp:Send('Addpic', 'chart2d.pic')
  1250.  
  1251. This causes the Manuscript document 'laser.doc' to be
  1252. created from the template document 'laser.set'. It
  1253. will inherit all global format settings in
  1254. 'laser.set'. The first line will be the text 'Below is
  1255. a chart of categories' and after that will be a marker
  1256. for PIC file chart2d.pic which will be seen when the
  1257. document is either printed or previewed.
  1258.  
  1259. @@ CHT Class
  1260.  
  1261. CHT Class (External Class)
  1262.  
  1263. The Chart class extends the SCN class by allowing a
  1264. SCN button control to be used as a chart. Through the
  1265. messages provided, data can be put into the chart and
  1266. plotted in three basic styles. The methods
  1267. automatically label the chart's axes and scale the
  1268. data according to the size of the SCN button control.
  1269. If the data changes then the chart is re-scaled and
  1270. axis adjusted to reflect the addition of new data. For
  1271. comparisons, more that one set of data can be plotted.
  1272.  
  1273. Optionally, if a hard copy is required, a PIC file can
  1274. be generated from a chart and using the WP class
  1275. (Manuscript only) be inserted into a document. For
  1276. example:
  1277.  
  1278.     SCREEN  lasercht
  1279.     ......
  1280.     PRIVATE aChartXaxis, aChartVals, aChartValBlk:={||
  1281. aChartVals}
  1282.     .......
  1283.     aChartXaxis =
  1284. {'ACT','MYS','SUS','CHI','COM','DOC','DRA','FOR','NOR',
  1285. 'MUS','MSC','SCF'}
  1286.     oLaserChart:= ADLClass('SCN', lasercht)
  1287.     aChart = oLaserChart:Send('Attributes', 10)
  1288.     oChart = ADLClass('CHT', {aChart, aChartValBlk,
  1289. aChartXaxis, 'Distribution of Film Categories'} )
  1290.     oChart:Send('LineGraph')
  1291.  
  1292. The code above can be used to display a linegraph in
  1293. screen lasercht using the screen button control
  1294. associated with event value 10. The array aChartvals
  1295. contains each set of values to be plotted, the X axis
  1296. will be labelled by aChartXaxis array.
  1297.  
  1298. @@ TXT Class
  1299.  
  1300. TXT Class (External Class)
  1301.  
  1302. The DOS text file Class is a simple means of using a
  1303. DOS text file as a device driver instead of the
  1304. built-in WP class. The methods are shown below :
  1305.  
  1306. CLASS TXT
  1307.  
  1308. FUNCTION Open
  1309.    PRIVATE txtfile, handle
  1310.    txtfile = self:set()
  1311.    handle = FCREATE (txtfile)
  1312.    self:Private(handle)
  1313.    RETURN
  1314.  
  1315. FUNCTION Add
  1316.    PARAMETER txt
  1317.    FWRITE (self:private(), txt)
  1318.    RETURN NIL
  1319.  
  1320. FUNCTION Addline
  1321.    PARAMETER txt
  1322.    FWRITE (self:private(), txt+chr(13)+chr(10))
  1323.    RETURN NIL
  1324.  
  1325. FUNCTION Close
  1326.    FCLOSE (self:private())
  1327.    RETURN NIL
  1328.  
  1329. FUNCTION NewPage
  1330.    FWRITE (self:private(), chr(12))
  1331.    RETURN NIL
  1332.  
  1333. Notice the use of the private data structure to hold
  1334. the file handle. This will protect it from any program
  1335. that uses this class. To declare an DOS text file
  1336. object requires :
  1337.  
  1338.     oLaserTxt:=   ADLClass('TXT', 'laser.doc')
  1339.  
  1340. @@ PRN Class
  1341.  
  1342. PRN Class (External Class)
  1343.  
  1344. To complete the Printing device Classes, a direct
  1345. printer Class is provided. The code is self
  1346. explanatory.
  1347.  
  1348. CLASS PRN
  1349.  
  1350. FUNCTION Open
  1351.    SET (23, .T.)   // Clipper Set printer ON
  1352.    RETURN
  1353.  
  1354. FUNCTION Add
  1355.    PARAMETER txt
  1356.    QOUT (txt)
  1357.    RETURN NIL
  1358.  
  1359. FUNCTION Addline
  1360.    PARAMETER txt
  1361.    QOUT (txt+chr(13)+chr(10))
  1362.    RETURN NIL
  1363.  
  1364. FUNCTION Close
  1365.    SET (23, .F.)   // Clipper Set printer OFF
  1366.    RETURN NIL
  1367.  
  1368. FUNCTION NewPage
  1369.    QOUT(chr(12))
  1370.    RETURN NIL
  1371.  
  1372. @@Language
  1373.  
  1374. DB-TALK Language
  1375.  
  1376. To do anything useful with DB-TALK involves coding a
  1377. Function or Procedure. DB-TALK does not make any
  1378. difference between the two. In fact both names are
  1379. interchangable.
  1380.  
  1381. Execution starts with a Function named 'Main'.
  1382.  
  1383. There are no commands in a DB-TALK Function. A DB-TALK
  1384. Function starts with the  function declaration
  1385. 'FUNCTION' and ends with 'RETURN' which can prefix an
  1386. optional expression to be evaluated and passed back as
  1387. the value of the Function.
  1388.  
  1389. The body of the Function consists of variable
  1390. declarations, control constructs and expressions to be
  1391. evaluated. The evaluation always results in a value
  1392. and this value may be ignored, assigned to a variable
  1393. which will inherit its data type from the value or can
  1394. be used by a control construct to make a decision.
  1395.  
  1396. DB-TALK functions can contain comments which must have
  1397. an asterisk in column one or // after the expression.
  1398. In addition DB-TALK supports a special comment which
  1399. can be used for debugging.
  1400.  
  1401. Any comment line which begins with a double asterisk
  1402. will be interpreted as a normal DB-TALK expression if
  1403. 'TRACE' has been set on with the SETTRACE function.
  1404. This will allow status describing comments to come
  1405. alive when a trace is required to find out what a
  1406. DB-TALK function is doing.
  1407.  
  1408. For example :
  1409.  
  1410. FUNCTION DisplayFile
  1411. PARAMETER cFileName
  1412.  
  1413. ** 'File is '+cFileName
  1414. *  Test if file exists
  1415.  
  1416. IF file (cFileName)
  1417.    fp = FOPEN(cFileName)   // Open File
  1418. ...
  1419.  
  1420. If TRACE is on, then whenever this function is
  1421. invoked, it will report into the log file, the name of
  1422. the file it is about to display.
  1423.  
  1424. @@ Expressions
  1425.  
  1426. DB-TALK Expressions
  1427.  
  1428. A DB-TALK expression is a stack of objects operated
  1429. upon by their methods. Expressions are normally
  1430. written in shorthand mathematical form.
  1431.  
  1432. For example, consider the numeric expression a + b /
  1433. (c - d) can be written as DIVIDE ( ADD (a, b),
  1434. SUBTRACT (c, d) ) if we assume Clipper Operators '+',
  1435. '/' and '-' are the shorthand form of the Clipper
  1436. Operator Class Methods Add, Divide, and Minus.
  1437.  
  1438. Expressions consist of basic Clipper Operators,
  1439. Clipper Functions, DB-TALK pre-defined Class Methods,
  1440. user-defined Class Methods and DB-TALK Functions.
  1441.  
  1442. @@ Operators
  1443.  
  1444. There are four Operator Classes:
  1445.  
  1446. Arithmetic, Relational, Logical and String and Date
  1447.  
  1448. Arithmetic Operators
  1449.  
  1450. The following arithmetic operators are supported by
  1451. DB-TALK
  1452.  
  1453. +    Addition
  1454. -    Subtraction
  1455. *    Multiplication
  1456. /    Division
  1457. %    Modulus (returns the remainder or a division)
  1458. ^    Exponential
  1459. **   Exponential
  1460.  
  1461. Operations are solved from left to right. First, any
  1462. portions of the expression in parentheses is
  1463. performed. Second, exponentiation is performed. Third,
  1464. multiplication and division are performed. Last,
  1465. addition and subtraction are performed.
  1466.  
  1467. Relational Operators
  1468.  
  1469. The following relational operators are supported by
  1470. DB-TALK
  1471.  
  1472. <    Less than
  1473.  
  1474. >    Greater than
  1475.  
  1476. =    Equal to
  1477.  
  1478. ==   Exactly equal to
  1479.  
  1480. #    Not equal to
  1481.  
  1482. !=   Not equal to
  1483.  
  1484. <=   Less than or equal to
  1485.  
  1486. >=   Greater than or equal to
  1487.  
  1488. $    is contained in
  1489.  
  1490. The result of all relational operations ie either TRUE
  1491. (.T.) Or FALSE (.F.). Evaluation can be evaluated from
  1492. left to right and parentheses can be used to alter the
  1493. order of evaluation as they all have the same
  1494. precedence. Relational operators have lower precedence
  1495. than arithmetic operators.
  1496.  
  1497. Logical Operators
  1498.  
  1499. The following logical operators are supported by
  1500. DB-TALK
  1501.  
  1502. .AND. Both the left and right expressions must be
  1503.        true for the whole expression to be true
  1504.  
  1505. .OR.  If either the left and right expressions is
  1506.        true, the whole expression is true
  1507.  
  1508. .NOT.  Negate expression
  1509.  
  1510. Logical expressions are evaluated in the following
  1511. order:
  1512.  
  1513. 1.   Any expressions in parentheses
  1514.  
  1515. 2.   .NOT.
  1516.  
  1517. 3.   .AND.
  1518.  
  1519. 4.   .OR.
  1520.  
  1521. String Operators
  1522.  
  1523. There are two string operators are supported by
  1524. DB-TALK
  1525.  
  1526. +    Concatenation with trailing spaces
  1527. -    Concatenation without trailing spaces
  1528.  
  1529. Date Operators
  1530.  
  1531. There are two date operators are supported by DB-TALK
  1532.  
  1533. +    Add days to a date to derive a new date
  1534. -    Subtract days from a date to derive a new date or
  1535. subtract two dates.
  1536.  
  1537. Object Operators
  1538.  
  1539. There are two object operators in DB-TALK
  1540.  
  1541. Send  Passes a message to a DB-TALK object and causes
  1542.        a method to be invoked
  1543. Set   It is used to get and/or set the data structure
  1544.        of a DB-TALK object.
  1545.  
  1546. @@ Variables
  1547.  
  1548. DB-TALK Variables
  1549.  
  1550. DB-TALK supports eight types of memory variables :
  1551.  
  1552. 1.   String (Max 64K)
  1553.  
  1554. 2.   Numeric (Max 19 bytes)
  1555.  
  1556. 3.   Date (8 bytes)
  1557.  
  1558. 4.   Logical (1 byte)
  1559.  
  1560. 5.   Bit Map (8 bits per byte Max 64K)
  1561.  
  1562.     3 functions are provided to manipulate bit
  1563.      strings
  1564.  
  1565.      lOn = BitTest(cBitString, nPosition)
  1566.  
  1567.      cNewString = BitSet(cBitString, nPostion)
  1568.  
  1569.      cNewString = BitReset(cBitString, nPosition)
  1570.  
  1571. 6.   Clipper Code Blocks
  1572.  
  1573. 7.   Clipper Objects
  1574.  
  1575. 8.   DB-TALK Objects
  1576.  
  1577. DB-TALK supports arrays. Arrays can consist of 4096
  1578. elements. Elements are independent in type and each
  1579. element type can be of the six types including nested
  1580. arrays. They follow the same rules as memory
  1581. variables.
  1582.  
  1583. Careful selection of a variable's scope is important
  1584. to a function's readability. When you declare a
  1585. variable the trick is to restrict it to only where it
  1586. should be seen. It should be invisible everywhere else
  1587. otherwise you will have problems tracking it. If you
  1588. are not into the habit of declaring your variables
  1589. where you need them you wont be able to appreciate the
  1590. complexity of writing the code of DB-TALK.
  1591.  
  1592. When you are studying a function from a 10,000 line
  1593. program, the fewer things you have to worry about the
  1594. better.
  1595.  
  1596. The lifetime of a variable of determines how long the
  1597. variable hangs around in memory. This differs from its
  1598. scope. A variable may go out of scope so you cannot
  1599. access it any longer, but its value may remain so that
  1600. it is available the next time it comes into scope.
  1601. Again the shorter the lifetime, the better. There is
  1602. nothing more frustrating than to trying to work out
  1603. what an used variable is doing.
  1604.  
  1605. DB-TALK supports one basic scope for variables;
  1606. Private. Global and Local scopes can be simulated.
  1607.  
  1608. If a variable has a private scope, it is visible in a
  1609. particular function and any called from it. You
  1610. declare variables with a private scope using the
  1611. 'PRIVATE ' key-word, followed by a comma separated
  1612. list of variable names. For example
  1613.  
  1614. FUNCTION main_process      FUNCTION sub_process
  1615. PRIVATE a                  .....
  1616. a = 15                     QOUT (a)
  1617. SUB_PROCESS ()             RETURN
  1618. RETURN
  1619.  
  1620. The variable a is visible inside sub_process but will
  1621. not be visible from a function that calls
  1622. main_process. This is private scoping. IF a is
  1623. declared within sub_process, the value of a in
  1624. main_process will no more be visible in sub_process.
  1625. DB-TALK will create a new copy of it and the QOUT
  1626. function will result in a run-time error as a does not
  1627. have a value. This is simulated local scoping.
  1628.  
  1629. A variable with global scope is visible everywhere
  1630. from the moment it is declared. In DB-TALK, Private
  1631. variables declared in 'MAIN' function have a global
  1632. scope. Global variables never go out of scope. The
  1633. program will have to release global variables
  1634. explicitly.
  1635.  
  1636. Private and local variables have lifetimes limited to
  1637. the duration of the functions in which they are
  1638. declared while global variables wait around until the
  1639. programmer gets rid of them or till the end of the
  1640. program.
  1641.  
  1642. @@ Sequences
  1643.  
  1644. Sequences
  1645.  
  1646. Sequences are a group of DB-TALK expressions evaluated
  1647. one after the other. The group of expressions are
  1648. delimited with BEGIN and END statements.
  1649.  
  1650. Sequences are coded in DB-TALK as follows
  1651.  
  1652. BEGIN
  1653.    expression 1 ......
  1654.    expression 2 ......
  1655.    expression 3 ......
  1656. END
  1657.  
  1658. @@ Selections
  1659.  
  1660. Selections
  1661.  
  1662. Selections are sequences of expressions to be
  1663. evaluated based on the evaluation of mutually
  1664. exclusive conditions. Provision is made to evaluate a
  1665. 'default' sequence if all the conditions evaluate as
  1666. FALSE.
  1667.  
  1668. Selections are coded in DB-TALK as follows
  1669.  
  1670. IF <condition 1>
  1671.    sequence 1 ......
  1672.  
  1673. ELSEIF <condition 2>
  1674.    sequence 2 ......
  1675.  
  1676. ELSE
  1677.    sequence n ......
  1678. ENDIF
  1679.  
  1680. <condition 1> is the first trigger. If <condition 1>
  1681. evaluates as TRUE, then sequence 1 is evaluated
  1682. otherwise <condition 2> becomes the next trigger. IF
  1683. both or more conditions all evaluate as FALSE, then
  1684. sequence n will be evaluated by default. 'ELSEIF' and
  1685. 'ELSE' are optional in the construct.
  1686.  
  1687. @@ Iterations
  1688.  
  1689. Iterations
  1690.  
  1691. Iterations are sequences of expressions that a are
  1692. evaluated over and over until an exit condition
  1693. becomes TRUE.
  1694.  
  1695. Iterations are coded in DB-TALK as follows
  1696.  
  1697. sequence 1
  1698.  
  1699. DO WHILE <condition>
  1700.    sequence 2
  1701.    [EXIT]
  1702.    sequence 3
  1703.    [LOOP]
  1704.    sequence 4
  1705. ENDDO
  1706.  
  1707. sequence 5
  1708.  
  1709. <condition> is the main controller of the loop. If
  1710. <condition> evaluates as TRUE after the last
  1711. expression in sequence 1, then the iteration will
  1712. begin and continue until the last expression in
  1713. sequence 4 causes <condition> to evaluate FALSE and
  1714. cause control to pass to the first expression in
  1715. sequence 5.
  1716.  
  1717. EXIT and LOOP are optional and are usually used within
  1718. an IF construct to alter the flow based on secondary
  1719. conditions. The have the following effects. EXIT
  1720. causes the iteration to end and control passes
  1721. immediately to the first expression in sequence 5.
  1722. Sequences 3 and sequence 4 will be skipped. LOOP
  1723. passes control to the beginning of the iteration which
  1724. will be the first expression in sequence 2. Sequence 4
  1725. will be skipped.
  1726.  
  1727. @@ PARAMETER
  1728.  
  1729. PARAMETER
  1730.  
  1731. This directive declares the parameters to be passed to
  1732. a function by listing their names following
  1733. 'PARAMETER'. When the function is called, it needs to
  1734. be passed a list of values or variables. The procedure
  1735. refers to these using the declared names. The scope
  1736. and life of a parameter is private.
  1737.  
  1738. @@ PRIVATE
  1739.  
  1740. PRIVATE/LOCAL
  1741.  
  1742. Both names are interchangeable. Both declare private
  1743. variables whose scope and life is private to the
  1744. function in which they are defined.
  1745.  
  1746. @@ EXTERNAL
  1747.  
  1748. EXTERNAL
  1749.  
  1750. This declares an object file which contains a
  1751. collection functions and other resources. When
  1752. EXTERNAL is specified within a function, it is
  1753. actioned by the runtime engine. The '.ADL' file must
  1754. be available at runtime. It causes all the collected
  1755. resources to have a private  scope and life. When the
  1756. function terminates, memory occupied by the resources
  1757. is automatically freed. The choice between runtime
  1758. EXTERNAL and Compile-time EXTERNAL will depend on
  1759. finding a balance between speed and size.
  1760.  
  1761. @@ FUNCTION
  1762.  
  1763. FUNCTION/END FUNC
  1764.  
  1765. These statements delimits a function declaration. A
  1766. DB-TALK function is a Clipper array of codeblocks. It
  1767. is just another Clipper variable. It has global scope
  1768. and global life. The resource compiler puts it into
  1769. the auto-load list for the run-time system. When a
  1770. compiled DB-TALK program starts, the run-time engine
  1771. transfers everything in the auto-load list into
  1772. Clipper VM (Virtual memory).
  1773.  
  1774. @@ #DEFINE
  1775.  
  1776. #DEFINE
  1777.  
  1778. To enable readability, especially with object data
  1779. structures, named constants can be used. It allows
  1780. constants to be used in a program without involving
  1781. the run-time engine, thereby reducing memory overhead.
  1782. When the resource compiler sees a symbol, it replaces
  1783. it with the constant value. For example, given the
  1784. following code :
  1785.  
  1786. #define K_ESC 27
  1787.  
  1788. DO CASE
  1789.    CASE nKey = K_ESC
  1790.  
  1791. The compiler produces in the codeblocks :
  1792.  
  1793.  
  1794.  
  1795. DO CASE
  1796.    CASE nKey = 27
  1797.  
  1798. Note that #define is case sensitive. The convention
  1799. (derived from C) is to define all pre-processor
  1800. symbols in uppercase.
  1801.  
  1802. @@ EXTERNAL
  1803.  
  1804. EXTERNAL
  1805.  
  1806. The compile-time version of EXTERNAL causes the
  1807. resource compiler to include all the functions and
  1808. other resources of an object file in the program being
  1809. compiled. It allows class methods to specified
  1810. separately from the programs that will use them and
  1811. allow re-usability. Each function and resource has
  1812. global scope and life.
  1813.  
  1814. @@ INHERIT
  1815.  
  1816. INHERIT
  1817.  
  1818. Has the same effect as the EXTERNAL directive, with
  1819. the exception that all methods included now belong to
  1820. the class associated with the file being compiled.
  1821.  
  1822. @@ RESOURCE
  1823.  
  1824. Normal xBase programs including Clipper use DBF files
  1825. as program resources, DB-TALK programs have many more
  1826. resources at their disposal, because of the graphic
  1827. user interface. When you move the mouse around, a
  1828. pointer on the screen moves. This might have an arrow
  1829. shape, an hourglass shape, or something completely
  1830. different. These pointers are all resources. They are
  1831. special bitmaps that any application can use.
  1832. Likewise, the icons that appear in dialog boxes. Not
  1833. only does DB-TALK use resources for bitmaps, cursors
  1834. and icons, but uses them for creating various
  1835. application controls. For example, a DB-TALK screen is
  1836. maintained as a resource. This makes the specification
  1837. of the screen as an object through the 'SCN' class
  1838. very simple. It reduces the amount of code required to
  1839. define each control specified in the screen.
  1840.  
  1841. DB-TALK uses special directives and files for adding
  1842. resources to a program. These files are produced by a
  1843. variety of visual tools and are compiled by the
  1844. resource compiler which attaches the resources to the
  1845. application's executable. Because resources are
  1846. separate from the code, the appearance of an
  1847. application can be changed without having to change
  1848. the application's code.
  1849.  
  1850. At the start of a program, DB-TALK run-time creates
  1851. pointer variables for all resources. When a resource
  1852. is needed, DB-TALK goes to the resource section of the
  1853. executable and uses the pointer to load the resource
  1854. into Clipper VM. The only exception is program code
  1855. which is loaded into Clipper VM directly. Any
  1856. user-defined resources which are controlled by the
  1857. developer must  be loaded into Clipper VMM with the
  1858. GETPOINTER function.
  1859.  
  1860. The only feature available in DB-TALK and not in
  1861. Clipper, is that object specifications can be done
  1862. with an external visual tool and used without
  1863. compiling into Clipper code. All non-code resources
  1864. can be included with the code in the object
  1865. specification. Just like code, a developer can inherit
  1866. the resources and reuse without knowing the details of
  1867. what they are. For example :
  1868.  
  1869. It is possible to compile a calculator class
  1870. consisting of all the methods, screen, icons, and
  1871. fonts required into an object file called 'CALC.ADL'.
  1872.  
  1873. To use this calculator in another application, the
  1874. developer does not need to know what resources the
  1875. calculator uses, simply declare it external and it
  1876. becomes operational as in :
  1877.  
  1878. EXTERNAL calc
  1879.  
  1880. oCalc = ADLClass ('CAL')
  1881. oCalc:Send('Initialise')
  1882. ......
  1883. ......
  1884.  
  1885. DB-TALK supports nine resource types. Each resource
  1886. will be explained in detail in the next chapter. The
  1887. Visual tool required to maintain it will also be
  1888. explained.
  1889.  
  1890. @@ SCREEN
  1891.  
  1892. SCREEN Resource
  1893.  
  1894. DB-Talk screens is composed of a number of controls,
  1895. such as textboxes, browse objects etc. When the user
  1896. selects a control either by the keyboard or by a
  1897. mouse, the control receives a message that it has been
  1898. activated. Further action depends on what type of
  1899. control was selected.
  1900.  
  1901. Action Buttons
  1902.  
  1903. Buttons invoke an action. They are used to present
  1904. actions (verb items) to the user. For example,buttons
  1905. are used to start or cancel operations. DB-TALK
  1906. through GFORCE provides four types of buttons :
  1907.  
  1908. Momentary buttons :
  1909.  
  1910. These buttons simulate a depress when clicked. They
  1911. are pressed just like push buttons on a telephone.
  1912.  
  1913. Alternate buttons
  1914.  
  1915. These buttons require a press to activate and a press
  1916. to deactivate like the power switch of a TV.
  1917.  
  1918. Indicator buttons
  1919.  
  1920. These are buttons that do not move when pressed so
  1921. that your application can draw on their surface.
  1922.  
  1923. Invisible buttons
  1924.  
  1925. This is a special case of a momentary button that can
  1926. be pressed but does not visually respond, a bit like a
  1927. magic eye.
  1928.  
  1929. Radio Buttons and Checkboxes
  1930.  
  1931. Radio buttons and checkboxes are used to select from
  1932. among a set of choices. They present the user with a
  1933. list of choices from which more than one item can be
  1934. selected at the same time. When a checkbox is
  1935. selected, an X appears inside it. When a radio button
  1936. is selected, it is filled with a dark circle. DB-TALK
  1937. programs are not notified of these changes.
  1938.  
  1939. DB-TALK uses the bit data type to manages radio
  1940. buttons and check boxes. Each radio button or checkbox
  1941. corresponds to a bit position in a bit string. DB-TALK
  1942. will automatically set and reset the appropriate bits
  1943. when the user sets or resets the associated radio
  1944. button or checkbox.
  1945.  
  1946.  Use radio buttons and checkboxes to present choices.
  1947.  
  1948. Data Entry Fields
  1949.  
  1950. Data entry fields are used for entering data. Data
  1951. entry fields are used to support three types of data
  1952. entry.
  1953.  
  1954. Clipper GET objects (Only Available in advanced
  1955. Runtime Engine)
  1956.  
  1957. These are standard xBase @ .. get data entry fields.
  1958. In DB-TALK programs, they are used to enter a single
  1959. line of data. The data could be of type numeric, text,
  1960. date or logical. The developer has control on the
  1961. picture, colour and position of each Get object.
  1962.  
  1963. Clipper Memo fields
  1964.  
  1965. These are multiple text line fields. DB-TALK uses the
  1966. standard Clipper memo functions to provide simple WP
  1967. like editing on text. The user can move the cursor
  1968. through the text in the box, delete characters,
  1969. word-wrap and so on.
  1970.  
  1971. Clipper TBrowse Objects (Only Available in advanced
  1972. Runtime Engine)
  1973.  
  1974. A data entry field could also be used for a Clipper
  1975. Tbrowse object. Whenever the field is selected,
  1976. DB-TALK will activate user-interaction with the
  1977. TBrowse object. The Tbrowse object is fully
  1978. mouse-aware. The Tbrowse will react to any buttons set
  1979. up the screen for cursor control.
  1980.  
  1981. Graphic Objects
  1982.  
  1983. Graphic objects are static objects. The user cannot
  1984. change or modify them, clicking on them has no effect.
  1985. They are facilities for display presentation. Their
  1986. intended use is to aid the production of professional
  1987. looking screens. Basically the add a lot of spice to
  1988. the The appearance of the screen.  Text objects can be
  1989. use to label the data entry fields. To make graphic
  1990. objects active, the developer could put an invisible
  1991. button underneath.
  1992.  
  1993. Frames
  1994.  
  1995. Frames are graphic objects that provide a three
  1996. dimensional illusion of height or depth.
  1997.  
  1998. Line, Rectangle and Circle
  1999.  
  2000. These are basic vector graphic lines, rectangles and
  2001. circles drawn between a number of points.
  2002.  
  2003. Bitmaps and Icons
  2004.  
  2005. Bitmaps are graphical pictures. Placing bitmaps in
  2006. screens can add a lot of pizazz. Icons are fixed sized
  2007. bitmaps (32x32 pixels) which can illustrations or
  2008. logos to screens. Bitmaps can be used like buttons by
  2009. placing invisible or indicator buttons underneath.
  2010. This causes an event to be activated when the bitmap
  2011. or icon is clicked.
  2012.  
  2013. Text
  2014.  
  2015. Text can be used as captions to label parts of a
  2016. screen. For example, they are often used to label text
  2017. entry fields.
  2018.  
  2019. Creating and using screens
  2020.  
  2021. The SCRNEDIT tool is provided to create screens. You
  2022. design screens by drawing them. You select controls to
  2023. add, then interactively move them on the screen to the
  2024. desired position. You can change the size, position,
  2025. and other attributes of each control at any time. The
  2026. screen tool stores the description of the controls
  2027. defined in a SCN file. Icons and bitmaps referenced
  2028. are not stored in this file only the reference is kept
  2029. in this file. To include icons and bitmaps of a screen
  2030. in an application, they must be treated as separate
  2031. resources.
  2032.  
  2033. To use a screen in an application, the SCREEN compiler
  2034. directive is used to cause the resource compiler to
  2035. include the screen file in the compilation.
  2036.  
  2037. At the beginning of the application, create a screen
  2038. object from the 'SCN' class using the ADL Class
  2039. library function 'ADLClass'. For example :
  2040.  
  2041. SCREEN laserscr
  2042. ....
  2043. .....
  2044. oLaserScn = ADLClass ('SCN', laserscr)
  2045.  
  2046. Standard Screens
  2047.  
  2048. Certain parts of a program's user interface are common
  2049. to many applications. In particular, all programs need
  2050. a way to display warning messages, obtain simple input
  2051. without designing custom screens. DB-TALK provides
  2052. pre-defined screen resources called dialog boxes for
  2053. this purpose. Each dialog box is accessed via simple
  2054. function calls.
  2055.  
  2056. @@  MessageBox
  2057.  
  2058. MessageBox
  2059.  
  2060. Purpose
  2061.  
  2062. This is a simple way of displaying messages on the
  2063. screen. A heading can be displayed. In addition, up to
  2064. five lines of text can be displayed. To spice the
  2065. display, an icon resource can be specified to appear
  2066. in the top left corner.
  2067.  
  2068. Syntax
  2069.  
  2070. MessageBox (cHeading, cText, cIconbuff)
  2071.  
  2072. Comments
  2073.  
  2074. cHeading is a 30 character heading text. cText is a
  2075. the message that can be formatted into 5 lines of 30
  2076. characters and cIconbuff is an icon resource.
  2077.  
  2078. Example
  2079.  
  2080.      ICON stop
  2081.      ......
  2082.      MessageBox ('Warning', 'Backup Files', stop)
  2083.  
  2084. @@  TextBox
  2085.  
  2086. TextBox
  2087.  
  2088. Purpose
  2089.  
  2090. This is a simple way of entering a single text
  2091. value.  A caption can be displayed.
  2092.  
  2093. Syntax
  2094.  
  2095. TextBox (cCaption, @cTextVar)
  2096.  
  2097. Comments
  2098.  
  2099. cCaption is a 30 character text label. cTextVar is the
  2100. variable into which the text will be input.
  2101.  
  2102. Example
  2103.  
  2104.      nAge = 35
  2105.      TextBox ('Enter Age', @nAge)
  2106.  
  2107. @@  YesNoBox
  2108.  
  2109. YesNoBox
  2110.  
  2111. Purpose
  2112.  
  2113. This is a simple way of enabling the user to make a
  2114. Yes or No choice. A heading and a message can be
  2115. displayed.
  2116.  
  2117. Syntax
  2118.  
  2119. lChoice = YesNoBox (cHeading, cText, [cYesOption],
  2120. [cNoOption])
  2121.  
  2122. Comments
  2123.  
  2124. cHeading is a 30 character heading text. cText is a 30
  2125. character message. cYesOption and cNoOption are
  2126. optional words that can be used instead of 'Yes' and
  2127. 'No' respectfully. lChoice is logical value indicating
  2128. if 'Yes' was chosen or not.
  2129.  
  2130. Example
  2131.  
  2132.      YesNoBox ('Warning', 'You wish to Quit')
  2133.  
  2134. @@  PickBox
  2135.  
  2136. PickBox
  2137.  
  2138. Purpose
  2139.  
  2140. This is a simple way of enabling the user to visually
  2141. select an entry from an array. For example, it can be
  2142. used to select a file from a directory listing.
  2143.  
  2144. Syntax
  2145.  
  2146. PickBox (cHeading, aPickArray)
  2147.  
  2148. Comments
  2149.  
  2150. cHeading is a 30 character heading text. aPickArray is
  2151. an array which will contain the entries to be picked
  2152. from.
  2153.  
  2154. Example
  2155.  
  2156.      cFileName = PickBox ('Select File', ADIR('*.*'))
  2157.  
  2158. @@  BrowseBox
  2159.  
  2160. BrowseBox
  2161.  
  2162. Purpose
  2163.  
  2164. This is a simple way of enabling the user to visually
  2165. select a database record.
  2166.  
  2167. Syntax
  2168.  
  2169. BrowseBox (cHeading, cFieldName)
  2170.  
  2171. Comments
  2172.  
  2173. cHeading is a 30 character heading text. cFieldName is
  2174. the key field from the correctly opened database file
  2175. which will be used to select the record.
  2176.  
  2177. Example
  2178.  
  2179.      BrowseBox ('Select Employee', 'Emp_No')
  2180.  
  2181. @@ DATABASE
  2182.  
  2183. DATABASE Resource
  2184.  
  2185. The database is the main resource provided by xBase
  2186. systems including Clipper. DB-TALK simplifies that
  2187. amount of code needed to use this resource. DB-TALK
  2188. manages the database files, indexes, filters and
  2189. relationships through a Database View resource.
  2190.  
  2191. Database Files (DBF)
  2192.  
  2193. DB-TALK uses standard Clipper DBF files. The DBF file
  2194. contains data about a number of data fields. The
  2195. database view allows a subset of the data fields
  2196. defined to be selected. The DBF format can natively
  2197. deal with the following field types:
  2198.  
  2199. Character
  2200.  
  2201. Fixed length strings up to 64K.
  2202.  
  2203. Numeric
  2204.  
  2205. Up to 19 digits in length, counting decimal points in
  2206. noninteger fields.
  2207.  
  2208. Date
  2209.  
  2210. Fixed length of 8 bytes
  2211.  
  2212. Logical
  2213.  
  2214. Boolean values (.T., .F.) One byte in length
  2215.  
  2216. Memo
  2217.  
  2218. Variable length character strings (minimum 512 bytes)
  2219. stored in companion .DBT file.
  2220.  
  2221. Index Files (NTX)
  2222.  
  2223. DB-TALK uses Clipper NTX index files. Indexes are
  2224. provided to perform fast lookup of records in the DBF
  2225. file. They also enable DBF records to be processed in
  2226. an order other than numerically.   DB-TALK maintains
  2227. the relationships between a DBF and its indexes
  2228. through the View resource.
  2229.  
  2230. Filters
  2231.  
  2232. In most cases, subsets and not the entire data of a
  2233. database file is required in an application. When this
  2234. situation occurs, records must be filtered. DB-TALK
  2235. allows a filter control to be attached to each
  2236. database file in a View.
  2237.  
  2238. Relationships
  2239.  
  2240. Relationships are defined between database files. The
  2241. only relationships supported are those classified as
  2242. one to many. In other words, many records of one
  2243. database file refers to one record in the other. An
  2244. example is the relationship between invoices and their
  2245. details. Each invoice has many details, but each
  2246. detail refers to one invoice. In this example, invoice
  2247. is called the parent while the detail is called the
  2248. child.
  2249.  
  2250. Every time the parent's record pointer is moved, the
  2251. child's record pointer is moved to the associated
  2252. record.
  2253.  
  2254. Creating and using a database
  2255.  
  2256. The DBU tool is provided to create a database view.
  2257. All the database files, fields, indexes, filters and
  2258. relationships can be defined with DBU.  The screen
  2259. tool stores the description of the view defined in a
  2260. VEW file.
  2261.  
  2262. To use a database view in an application, the DATABASE
  2263. compiler directive is used to cause the resource
  2264. compiler to include the database view file in the
  2265. compilation.
  2266.  
  2267. At the beginning of the application, create a database
  2268. view object from the 'DBF' class using the ADL Class
  2269. library function 'ADLClass'. For example :
  2270.  
  2271. DATABASE laservew
  2272. ....
  2273. .....
  2274. oLaserView = ADLClass ('DBF', laservew)
  2275.  
  2276. @@ WALLPAPER
  2277.  
  2278. WALLPAPER Resource
  2279.  
  2280. The wallpaper resource is used to support the screen resource. It defines an
  2281. icon that will be used to paint the screen while the application is loading. It
  2282. will remain on the screen during the application unless the screen is cleared
  2283. under program control. The wallpaper resource is used to put the icon bitmap
  2284. into an application or reusable object file.
  2285.  
  2286. For Example :
  2287.  
  2288. WALLPAPER zigzag
  2289.  
  2290. will include the file 'ZIGZAG.ICN' in the compilation.
  2291.  
  2292. @@ PALETTE
  2293.  
  2294. PALETTE Resource
  2295.  
  2296. The palette resource is used to support the screen resource. It defines a VGA
  2297. palette scheme to be used for the application. Although no palette editor is
  2298. supplied, a number of palettes are supplied with DBTALK.
  2299.  
  2300. The palette resource is used to put the palette file into an application or
  2301. reusable object file.
  2302.  
  2303. For Example :
  2304.  
  2305. PALETTE snowlite
  2306.  
  2307. will include the file 'SNOWLITE.PAL' in the compilation.
  2308.  
  2309. @@ TEXT
  2310.  
  2311. TEXT Resource
  2312.  
  2313. The TEXT resource is a simple means of including formatted text into an
  2314. application. This can be used for various purposes.
  2315.  
  2316. Formatted error messages can included in an application and displayed in a
  2317. screen or a report.
  2318.  
  2319. It can also be used for printing designer forms.
  2320.  
  2321. To access the stored text in an application, the GetPointer function is used as
  2322. follows :
  2323.  
  2324.     cText = GetPointer (aTextResName)
  2325.  
  2326. For example :
  2327.  
  2328. TEXT aboutmsg
  2329. ..
  2330. cMess = GetPointer (aboutmsg)
  2331.  
  2332. The stored text can contain variable names and expressions (delimited with //)
  2333. which can be evaluated at run-time. For example, if aboutmsg.txt contained :
  2334.  
  2335. Laser Demo Application
  2336. By Dele Olajide
  2337.  
  2338. //Memory(0)//K bytes free
  2339.  
  2340. then ExpandText function can be used to obtain the exact amount of memory
  2341. available at run time with :
  2342.  
  2343. cMess = ExpandText (GetPointer (aboutmsg))
  2344.  
  2345. @@ ARRAY
  2346.  
  2347. ARRAY Resource
  2348.  
  2349. The Array resource provides the means of including user-defined resources. This
  2350. resource includes the user-specified array into the application.
  2351.  
  2352. The array can be nested and of any size. It is loaded into VMM by DBTALK when
  2353. the application begins. It is directly accessible in the application by name.
  2354.  
  2355. It can be used to reduce the amount of code required for setting up tables and
  2356. data structures like menus and reports.
  2357.  
  2358. The user must write a 'resource tool' program which will create/maintain the
  2359. resource in array form. This program must create the array file in the ARRTOSTR
  2360. format with extension 'ARR'. For example.
  2361.  
  2362. FUNCTION main
  2363.  
  2364. #DEFINE HELP    28
  2365. #DEFINE K_ESC   27
  2366. #DEFINE K_DOWN  24
  2367. #DEFINE K_UP    5
  2368. #DEFINE K_RIGHT 4
  2369. #DEFINE K_LEFT  19
  2370. #DEFINE K_HOME  1
  2371. #DEFINE K_END   6
  2372. #DEFINE K_PGUP  18
  2373. #DEFINE K_PGDN  3
  2374.  
  2375.    PRIVATE mtext   := {"File",  "Nominal", "Sales","Purchase", "Inventory",
  2376. "Reports", "Activity"}
  2377.    PRIVATE mkey    := { 289,     305,       287,    281,        279,
  2378. 275,     286}
  2379.  
  2380.    PRIVATE mt1:= {"Accounts", "Customer", "Supplier", "Product", "Company",
  2381. "Exit"}
  2382.    PRIVATE mk1:= {1001,        1002,       1003,       1004,      1005,
  2383. K_ESC}
  2384.  
  2385.    PRIVATE mt2:= {"Enter Transactions", "Print Journals", "Print Details",
  2386. "Post Transactions", "Trial Balance",  "List of Accounts"}
  2387.    PRIVATE mk2:= {1011,                  1012,            1013,
  2388. 1014,               1015,              1016}
  2389.  
  2390.    PRIVATE mt3:= {"Enter Sales", "Print Journals", "Post Transactions"}
  2391.    PRIVATE mk3:= {1021,                  1022,            1023}
  2392.  
  2393.    PRIVATE mt4:= {"Enter Purchases", "Enter Cheques", "Print Cheques", "Print
  2394. Journals", "Post Transactions"}
  2395.    PRIVATE mk4:= {1031,                  1032,            1033,
  2396. 1034,               1035}
  2397.  
  2398.    PRIVATE mt5:= {"Adjust Stock", "Print Journals", "Post Transactions"}
  2399.    PRIVATE mk5:= {1041,                  1042,            1043}
  2400.  
  2401.    PRIVATE mt6:= {"Financial Reports", "Debtor Analysis", "Cash Flow", "Product
  2402. List", "Stock Activity",  "Stock Alert"}
  2403.    PRIVATE mk6:= {1051,                  1052,            1053,
  2404. 1054,               1055,              1056}
  2405.  
  2406.    PRIVATE mt7:= {"End Month Process", "End Year Process"}
  2407.    PRIVATE mk7:= {1061,                  1062}
  2408.  
  2409.    PRIVATE aMenu , cMenu, nOut
  2410.  
  2411.    aMenu = {'DbEasy Accounting System',mtext,mkey, ;
  2412.             {mt1,mt2,mt3,mt4,mt5,mt6,mt7},;
  2413.             {mk1,mk2,mk3,mk4,mk5,mk6,mk7} }
  2414.  
  2415.    cMenu = arrtostr (aMenu)
  2416.    nOut = FCREATE ('EAMENU.ARR')
  2417.    FWRITE(nOut, cMenu)
  2418.    FCLOSE (nOut)
  2419.    RETURN
  2420.  
  2421. creates an array file EAMENU.ARR which contains the menu structure for the
  2422. DBEASY demo program. To use the menu structure in the application simply
  2423. involves :
  2424.  
  2425. ARRAY eamenu
  2426. ....
  2427. oScr:Send('AttachMenu', eamenu)
  2428.  
  2429. and this makes the code much easier to maintain.
  2430.  
  2431. This feature makes it possible for DBTALK users to create their own classes and
  2432. any resource tools required for the class.
  2433.  
  2434. @@ ICON
  2435.  
  2436. ICON Resource
  2437.  
  2438. The icon resource is used to support the screen
  2439. resource. Icons referenced in a screen are not stored
  2440. in the screen file. The icon resource is use to put
  2441. the icon bitmap into an application or reusable object
  2442. file.
  2443.  
  2444. To use an icon in an application, the ICON compiler
  2445. directive is used to cause the resource compiler to
  2446. include the icon file in the compilation. For Example
  2447. :
  2448.  
  2449. ICON stop
  2450.  
  2451. will include the file 'STOP.ICN' in the compilation.
  2452.  
  2453. @@ BITMAP
  2454.  
  2455. BITMAP Resource
  2456.  
  2457. The bitmap resource is used to support the screen
  2458. resource. Bitmap graphics referenced in a screen are
  2459. not stored in the screen file. The bitmap resource is
  2460. use to put the bitmap file into an application or
  2461. reusable object file.
  2462.  
  2463. Bitmaps in DB-TALK are stored in an internal format
  2464. compatible with Clipper character strings. The Gforce
  2465. conversion utility PCX2BMP is supplied with DB-TALK to
  2466. take a PCX format file and convert it to Gforce BMP
  2467. format.
  2468.  
  2469. To use an bitmap in an application, the BITMAP
  2470. compiler directive is used to cause the resource
  2471. compiler to include the bitmap file in the
  2472. compilation. For Example :
  2473.  
  2474. BITMAP MAP
  2475.  
  2476. will include the file 'STOP.BMP' in the compilation.
  2477.  
  2478. @@ VECTOR
  2479.  
  2480. VECTOR Resource
  2481.  
  2482. The vector resource is used to support the screen
  2483. resource. Vector graphics referenced in a screen are
  2484. not stored in the screen file. The vector resource is
  2485. use to put the vector file into an application or
  2486. reusable object file.
  2487.  
  2488. Vectors in DB-TALK are stored in an internal format
  2489. compatible with Clipper character strings. A
  2490. conversion utility HPTOVEC is supplied with DB-TALK to
  2491. take a HP plot file and convert it to Dbtalk VEC
  2492. format.
  2493.  
  2494. HP plot files can be produced from any of the popular
  2495. drawing packages like Freelance or Draft Choice by
  2496. selecting an HP plotter as the device  and plotting to
  2497. a disk file.
  2498.  
  2499. To use an vector in an application, the VECTOR
  2500. compiler directive is used to cause the resource
  2501. compiler to include the vector file in the
  2502. compilation. For Example :
  2503.  
  2504. VECTOR WORLDMAP
  2505.  
  2506. will include the file 'WORLDMAP.VEC' in the
  2507. compilation.
  2508.  
  2509. @@ FONT
  2510.  
  2511. FONT Resource
  2512.  
  2513. The font resource allows font styles to be used in an
  2514. application. This allows custom fonts to display
  2515. special symbols, foreign language characters in non
  2516. standard alphabets or custom graphic characters.
  2517.  
  2518. To use a font in an application, the FONT compiler
  2519. directive is used to cause the resource compiler to
  2520. include the font file in the compilation. For Example
  2521. :
  2522.  
  2523. FONT SANSERIF
  2524.  
  2525. will include the file 'SANSERIF.FNT' in the
  2526. compilation.
  2527.  
  2528. @@CURSOR
  2529.  
  2530. There is no provision for user-defined cursors in
  2531. dbtalk. However the graphic cursor can be changed with
  2532. the following functions :
  2533.  
  2534.     mse_wait()   - Time/wait cursor
  2535.  
  2536.     mse_arrow()  - pointer cursor
  2537.  
  2538.     mse_ibeam()  - Text cursor
  2539.  
  2540.     mse_cross()  - cross cursor
  2541.  
  2542. @@ HELP
  2543.  
  2544. HELP Resource
  2545.  
  2546. The help resource is a simple way of providing up to
  2547. 100 help screens within an application. There can be
  2548. only one help resource in an application.
  2549.  
  2550. DB-TALK does not provide a Help engine. However using
  2551. the help resource, a developer can store up to 100
  2552. help pages which can be recalled in DB-TALK screen
  2553. with the HelpText function. For example to provide
  2554. help in a program when the F1 key is pressed :
  2555.  
  2556. #DEFINE HELP 28
  2557. SCREEN helpscr
  2558. HELP   helptext
  2559. ....
  2560. FUNCTION Main
  2561. ......
  2562. oHelpScr = ADLClass ('SCN', helpscr)
  2563. .....
  2564.  
  2565. FUNCTION handle
  2566. PARAMETER nEvent
  2567. .....
  2568.   CASE nEvent = CHOICE1
  2569.        cHelpText = HelpText(1)
  2570.  
  2571.   CASE nEvent = CHOICE2
  2572.        cHelpText = HelpText(2)
  2573.  
  2574.   CASE nEvent = HELP
  2575.        oHelpScr:Send('Display)
  2576.        oHelpScr:Send('Wait')
  2577.        oHelpScr:Send('Clear')
  2578.  
  2579. In this program, screen Helpscr contains a multi-line
  2580. text box cHelpText which will display context
  2581. sensitive help. When user choice CHOICE1 is selected,
  2582. context is set to Help page 1, when CHOICE2 is
  2583. selected, context is set to page 2. When HELP is
  2584. selected (F1 pressed), help screen pops up showing
  2585. what ever help context is set.
  2586.  
  2587. HELPTEXT.HLP is a text file is in the following
  2588. format:
  2589.  
  2590.         <header> (this text which is ingored by
  2591. Resource Compiler)
  2592.         <delimiter line>
  2593.         <block of help text>
  2594.         <delimiter line>
  2595.         <block of help text>
  2596.         .
  2597.         .
  2598.         .
  2599. Delimiter lines have the following format:
  2600.         /nn <comment>
  2601.  
  2602. where "/" is the first character on the line and "nn"
  2603. is a two digit ascii number. The comment is optional.
  2604.  
  2605. @@Messages
  2606.  
  2607. ADL Class Library Messages
  2608.  
  2609. This chapter describes the messages that a program can
  2610. send to a DB-TALK object. Objects are created with :
  2611.  
  2612.    oScrnObject = ADLClass ('SCN', scrnfile)
  2613.  
  2614. where scrnfile is a resource included in the
  2615. application. In this example, scrnfile is created from
  2616. the file 'SCRNFILE.SCN' which in turn was produced by
  2617. 'SCRNEDIT.EXE', the screen editor tool.
  2618.  
  2619. oScrnObject is passed messages using the send operator
  2620. like this:
  2621.  
  2622.    xResponse = oScrnObject:Send(cMessage,
  2623. xPara1,....xParaN)
  2624.  
  2625. cMessage is the message, xPara1.. xParaN are extra
  2626. values needed to support the message. xResponse is a
  2627. value returned by the method which handles the
  2628. message. For example :
  2629.  
  2630.    oLaserScrn:Send('Display', sanserif)
  2631.  
  2632. causes the 'Display' message to be passed to screen
  2633. object oLaserScrn with addition information that it
  2634. should use font resource sanserif. The value returned
  2635. should be discarded as it is of no interest to the
  2636. program.
  2637.  
  2638. The notation adopted is to prefix each variable with a
  2639. letter which indicates its type :
  2640.  
  2641. n    Numeric
  2642. c    Character/String
  2643. d    Date
  2644. l    Logigal
  2645. b    Code Block
  2646. x    Any type
  2647. ax   Array of type x
  2648.  
  2649. @@ Display
  2650.  
  2651. Display
  2652.  
  2653. Purpose
  2654.  
  2655. This message causes the screen to be painted with the
  2656. controls defined in the screen object. All data fields
  2657. will present their current stored values.
  2658.  
  2659. Syntax
  2660.  
  2661. oScrnObject:Send( 'Display', [cFont])
  2662.  
  2663. Comments
  2664.  
  2665. oScrnObject is a screen object created with the 'SCN'
  2666. built-in class, cFont is an optional font file
  2667. resource. If it is not specified, the screen is
  2668. displayed in the default system resource.
  2669.  
  2670. Example
  2671.  
  2672.      oLaserScrn:Send('Display', sanserif)
  2673.  
  2674. @@ Read
  2675.  
  2676. Read
  2677.  
  2678. Purpose
  2679.  
  2680. This message causes the system to wait until the user
  2681. activates any of the controls defined on the screen
  2682. object. The event number of the control is returned.
  2683. It is used for procedural handling of events.
  2684.  
  2685. Syntax
  2686.  
  2687. oScrnObject:Send( 'Read')
  2688.  
  2689. Comments
  2690.  
  2691. oScrnObject is a screen object created with the 'SCN'
  2692. built-in class.
  2693.  
  2694. Example
  2695.  
  2696.      nEvent = oLaserScrn:Send('Read')
  2697.  
  2698.      DO WHILE .T.
  2699.         DO CASE
  2700.         CASE nEvent = 27
  2701.              IF YesNoBox ('Warning', 'Do you wish to Quit')
  2702.                 Quit()
  2703.              ENDIF
  2704.  
  2705.         CASE nEvent = ??
  2706.         .......
  2707.         ENDCASE
  2708.         nEvent = oLaserScrn:Send('Read')
  2709.      ENDDO
  2710.  
  2711. @@ Wait
  2712.  
  2713. Wait
  2714.  
  2715. Purpose
  2716.  
  2717. This message causes the system to wait until the user
  2718. activates a specific control defined on the screen
  2719. object or event ESC is received. All other control
  2720. activated by the user are dealt with first by the
  2721. system handler and then the screen handlers. It is
  2722. used for data-driven handling of events.
  2723.  
  2724. Syntax
  2725.  
  2726. nEvent1 = oScrnObject:Send( 'Wait', [nEvent2])
  2727.  
  2728. Comments
  2729.  
  2730. oScrnObject is a screen object created with the 'SCN'
  2731. built-in class. nEvent2 is the button id or keyboard
  2732. code of the event that will terminate the interaction.
  2733. If it is omitted, code 27 (escape) is assumed. nEvent1
  2734. is the event that actually terminates the interaction.
  2735.  
  2736. Example
  2737.  
  2738.      nEvent = oLaserScrn:Send('Wait')
  2739.      nEvent = oLaserScrn:Send('Clear')
  2740.      ....
  2741.  
  2742.      FUNCTION handle
  2743.      PARAMETER nEvent
  2744.         IF nEvent = 27     // system handler
  2745.            IF YesNoBox ('Warning', 'Do you wish to Quit')
  2746.               Quit()
  2747.            ENDIF
  2748.         ENDIF
  2749.      RETURN nEvent        // pass on to screen handler
  2750.  
  2751.  
  2752.      FUNCTION Click
  2753.      PARAMETER nEvent    // screen handler
  2754.         IF nEvent = ??
  2755.         .......
  2756.         ENDIF
  2757.      ENDDO
  2758.  
  2759. @@ Refresh
  2760.  
  2761. Refresh
  2762.  
  2763. Purpose
  2764.  
  2765. This message causes the data entry screen controls to
  2766. be updated with their current values.
  2767.  
  2768. Syntax
  2769.  
  2770. oScrnObject:Send( 'Refresh')
  2771.  
  2772. Comments
  2773.  
  2774. oScrnObject is a screen object created with the 'SCN'
  2775. built-in class.
  2776.  
  2777. Example
  2778.  
  2779. Refresh
  2780.  
  2781.      oLaserScrn:Send('Refresh')
  2782.  
  2783. @@ Attributes
  2784.  
  2785. Attributes
  2786.  
  2787. Purpose
  2788.  
  2789. This message is used to retrieve the attributes of a
  2790. screen button control into an array. This allows other
  2791. classes or functions to access a screen button control
  2792. without hard coding its dimensions. An example of this
  2793. can be seen in the charting class.
  2794.  
  2795. Syntax
  2796.  
  2797. aButton = oScrnObject:Send( 'Attributes', nButtonId)
  2798.  
  2799. Comments
  2800.  
  2801. oScrnObject is a screen object created with the 'SCN'
  2802. built-in class. nButtonId is the event number defined
  2803. for the button by the screen editor. aButton is an
  2804. array containing the following information :
  2805.  
  2806. 1. Control Type : value Bn where n is the button
  2807.     type.
  2808.                    1. Mommentary
  2809.                    2. Alternate
  2810.                    3. Indicator
  2811.                    4. Invisible
  2812.                    5. Radio
  2813.                    6. CheckBox
  2814.  
  2815. 2. Top left corner X co-ordinate
  2816.  
  2817. 3. Top left corner Y co-ordinate
  2818.  
  2819. 4. Bottom right corner X co-ordinate
  2820.  
  2821. 5. Bottom right corner Y co-ordinate
  2822.  
  2823. 6. Width
  2824.  
  2825. 7. Height
  2826.  
  2827. 8. Foreground Colour
  2828.  
  2829. 9. Background Colour
  2830.  
  2831. 10.Botton text
  2832.  
  2833. 11.Botton Event no
  2834.  
  2835. 12.Button Control Type of 1 above in numeric
  2836.  
  2837. 13.Internal Button Id number
  2838.  
  2839. Example
  2840.  
  2841.      aMap = oMapScrn:Send('Attributes', MAP)
  2842.      VDOBUTTON (aMap[13])      // simulate button press
  2843.  
  2844. @@ Object
  2845.  
  2846. Object
  2847.  
  2848. Purpose
  2849.  
  2850. This message is used to retrieve the generated FLD
  2851. object data entry field of a screen. This allows other
  2852. classes or functions to access a screen data entry
  2853. controls without hard coding its attributes.
  2854.  
  2855. Syntax
  2856.  
  2857. oField = oScrnObject:Send( 'Object', cFieldName)
  2858.  
  2859. Comments
  2860.  
  2861. oScrnObject is a screen object created with the 'SCN'
  2862. built-in class. cFieldname is the field name defined
  2863. for the data entry field by the screen editor. oField
  2864. is a FLD object which can respond to the following
  2865. messages.
  2866.  
  2867. EDIT    : Force immediate data entry of field
  2868.  
  2869. REFRESH : Force immediate screen refresh of the data
  2870.            entry field.
  2871.  
  2872. PICK    : Use standard pickbox dialog box to be used
  2873.            to selecting a value from an array into the
  2874.            field.
  2875.  
  2876. Example
  2877.  
  2878.      oCity = oMapScrn:Send('Object', 'CITY')
  2879.      oCity:Send('Pick', {'Britain', 'France', 'USA'} )
  2880.  
  2881. @@ Clear
  2882.  
  2883. Clear
  2884.  
  2885. Purpose
  2886.  
  2887. This message causes the screen to be cleared and all
  2888. controls defined in the screen object removed.
  2889.  
  2890. Syntax
  2891.  
  2892. oScrnObject:Send( 'Clear')
  2893.  
  2894. Comments
  2895.  
  2896. oScrnObject is a screen object created with the 'SCN'
  2897. built-in class.
  2898.  
  2899. Example
  2900.  
  2901.      oLaserScrn:Send('Clear')
  2902.  
  2903. @@ AttachFilters
  2904.  
  2905. AttachFilters
  2906.  
  2907. Purpose
  2908.  
  2909. This message causes the events for a screen to be sent
  2910. to specific screen handling routines instead of the
  2911. default global screen handlers. When a user interacts
  2912. with any DBTALK screen, data entry events are first
  2913. sent to the system handler 'HANDLE' then sent to the
  2914. screen handle routines 'SELECT' and 'UNSELECT'. Action
  2915. button events are sent to a different routine 'CLICK'.
  2916. The developer can choose which routine should handle
  2917. the event. However, if there is a need to have a
  2918. sparate handle routine for a specific screen, then
  2919. this message can be issued.
  2920.  
  2921. Syntax
  2922.  
  2923. oScrnObject:Send( 'AttachFilters', cSelectRtn,
  2924. cDeSelectRtn, cClick)
  2925.  
  2926. Comments
  2927.  
  2928. oScrnObject is a screen object created with the 'SCN'
  2929. built-in class. cSelectRtn is the selection routine.
  2930. When a user selects a data entry field in this screen,
  2931. this function is given control. cDeSelectRtn is the
  2932. deselection routine. When the user finishes data entry
  2933. of a field, this routine is given control. cClick is
  2934. the action button routine. When any action button is
  2935. clicked, this routine is given control.
  2936.  
  2937. Example
  2938.  
  2939.      oLaserScrn:Send('AttachFilters', 'SelFld', 'DeSelFld',
  2940.      'Perform')
  2941.      ....
  2942.      FUNCTION SelFld
  2943.      PARAMETER cFld, oFld, oScrn
  2944.      PRIVATE lSelect:=.T.
  2945.      .....
  2946.      RETURN lSelect
  2947.  
  2948.  
  2949.      FUNCTION DeSelFld
  2950.      PARAMETER cFld, oFld, oScrn
  2951.      PRIVATE lValid:=.T.
  2952.      .....
  2953.      RETURN lValid
  2954.  
  2955.      FUNCTION Perform
  2956.      PARAMETER nEvent, oScrn
  2957.  
  2958.      IF nEvent = CHOICE1
  2959.      .....
  2960.  
  2961. @@ AttachMenu
  2962.  
  2963. AttachMenu
  2964.  
  2965. Purpose
  2966.  
  2967. This message causes the system menu to be associated
  2968. with a screen object. When this screen object is being
  2969. read, a user can activate the system pull-down menu.
  2970.  
  2971. Syntax
  2972.  
  2973. oScrnObject:Send( 'AttachMenu', aMenuSpec)
  2974.  
  2975. Comments
  2976.  
  2977. oScrnObject is a screen object created with the 'SCN'
  2978. built-in class. aMenuSpec is an array of the following
  2979. five data types:
  2980.  
  2981. cMenuTitle   : This text will appear above the menu
  2982.                 bar as the title of the application.
  2983.  
  2984. aPrompts     : This is an array consisting of the
  2985.                 main menu options that will apear on
  2986.                 the menu bar.
  2987.  
  2988. aPromptNos   : This is an array of event numbers that
  2989.                 the menu prompts will activate.
  2990.  
  2991. aPullPrompts : This is a two-dimensional array
  2992.                 containing the pull-down prompts for
  2993.                 all the prompts on the menu bar.
  2994.  
  2995. aPullNos     : This is a two dimensional array
  2996.                 containing the event numbers for the
  2997.                 pulldown prompts.
  2998.  
  2999. Example
  3000.  
  3001.      PRIVATE mtext   := {"File",  "Edit", "About"}
  3002.      PRIVATE mkey    := { 289,     274,   286}
  3003.      PRIVATE mfile_t := {{"Browse", "Chart", "Report",
  3004.      "Exit"}, {"Next","Previous"}, {"About"}}
  3005.      PRIVATE mfile_k := {{BROWSE, CATEGORY, REPORT,
  3006.      K_ESC},{K_RIGHT, K_LEFT}, {ABOUT}}
  3007.  
  3008.      oLaserScrn  = ADLClass('SCN', laserscr)
  3009.  
  3010.      oLaserScrn:Send('AttachMenu', {'Laser Disk Collection
  3011.      System',mtext,mkey,mfile_t,mfile_k})
  3012.      oLaserScrn:Send('Bar')
  3013.  
  3014. @@ Bar
  3015.  
  3016. Bar
  3017.  
  3018. Purpose
  3019.  
  3020. This message causes the system menu attached to the
  3021. screen object to be displayed and activated.
  3022.  
  3023. Syntax
  3024.  
  3025. oScrnObject:Send( 'Bar')
  3026.  
  3027. Comments
  3028.  
  3029. oScrnObject is a screen object created with the 'SCN'
  3030. built-in class.
  3031.  
  3032. Example
  3033.  
  3034.      oLaserScrn:Send('Bar')
  3035.  
  3036. @@Database
  3037.  
  3038. Database Messages
  3039.  
  3040. The database messages follow syntax and are all based
  3041. on the CLIPPER DML (Data Manipulation Language). The
  3042. syntax is
  3043.  
  3044. xResponse = oDbView:Send('DML command', cAlias,
  3045. xPara1.... xParaN)
  3046.  
  3047. xResponse is the response from the DML command.
  3048. oDbView is a DB-TALK database view object created with
  3049. the ADL Class 'DBF'. cAlias is the alias defined for
  3050. the database file to be accessed and xPara1....xParaN
  3051. are the additional values needed by the DML command.
  3052. For example :
  3053.  
  3054. lEofIndicator = oLaserView:Send('EOF', 'LASER')
  3055.  
  3056. Returns TRUE if end of file is reached on the
  3057. LASER.DBF file.
  3058.  
  3059. The DML commands are as follows :
  3060.  
  3061. OPEN
  3062.  
  3063. To open a database view, opening all database files
  3064. and indexes. Setting up all relationships and filters.
  3065.  
  3066. READ
  3067.  
  3068. To copy the values of fields defined in the database
  3069. view from the selected database file to memory
  3070. variables with the same name.
  3071.  
  3072. WRITE
  3073.  
  3074. To replace the values of fields defined in the
  3075. database view from memory variables with the same
  3076. name.
  3077.  
  3078. PICK
  3079.  
  3080. To position the database through the use of the
  3081. standard browsebox dialog box.
  3082.  
  3083. BOF
  3084.  
  3085. To determine whether the record pointer is located at
  3086. the beginning of the current database file
  3087.  
  3088. APPEND
  3089.  
  3090. To append a blank record to the current database file
  3091.  
  3092. COMMIT
  3093.  
  3094. To flush all buffered changes to disk.
  3095.  
  3096. DELETE
  3097.  
  3098. To mark current record for deletion.
  3099.  
  3100. GOBOTTOM
  3101.  
  3102. To position record pointer to the last record in the
  3103. database file.
  3104.  
  3105. GOTO
  3106.  
  3107. To position record pointer to a specific record in the
  3108. database file.
  3109.  
  3110. RECALL
  3111.  
  3112. To undelete a record marked for deletion.
  3113.  
  3114. REINDEX
  3115.  
  3116. To refresh an opened index.
  3117.  
  3118. SEEK
  3119.  
  3120. To locate records in a database file using an index
  3121. file.
  3122.  
  3123. SELECTAREA
  3124.  
  3125. To select a work area.
  3126.  
  3127. SETORDER
  3128.  
  3129. To change the master index to another opened index
  3130. file.
  3131.  
  3132. SKIP
  3133.  
  3134. To move the record pointer relative to the current
  3135. record
  3136.  
  3137. STRUCT
  3138.  
  3139. To create an array containing the structure of the
  3140. current database file
  3141.  
  3142. UNLOCKALL
  3143.  
  3144. To release all record and file locks in all work
  3145. areas.
  3146.  
  3147. DELETED
  3148.  
  3149. To find out if current record is deleted
  3150.  
  3151. EOF
  3152.  
  3153. To determine whether the record pointer is located at
  3154. the end of the current database file
  3155.  
  3156. FCOUNT
  3157.  
  3158. To determine the number of fields in a data file.
  3159.  
  3160. FLOCK
  3161.  
  3162. To attempt to lock the current database file so that
  3163. no other users can write to the file.
  3164.  
  3165. FOUND
  3166.  
  3167. To determine whether database record access was
  3168. successful.
  3169.  
  3170. LASTREC
  3171.  
  3172. To determine the number of records in a database file.
  3173.  
  3174. LOCK
  3175.  
  3176. To attempt to secure a record lock on a network.
  3177.  
  3178. NETERR
  3179.  
  3180. To determine whether an 'OPEN' or 'APPEND' has failed
  3181. on a network.
  3182.  
  3183. RECNO
  3184.  
  3185. To determine the value of the database record pointer
  3186.  
  3187. RECSIZE
  3188.  
  3189. To determine the record size of the current database
  3190. file
  3191.  
  3192. @@Reporting
  3193.  
  3194. Reporting Messages
  3195.  
  3196. One of the principles of Object-oriented designs is
  3197. not to duplicate functionally. Word Processing
  3198. programs, spreadsheets and DTP programs are the best
  3199. means of presenting information on paper.
  3200.  
  3201. Applications in DB-TALK are not supposed to
  3202. communicate directly with printers. It is pointless
  3203. duplicating a lot programming that is much more better
  3204. done in a word processor.
  3205.  
  3206. DB-TALK provides a WP class which allows WP documents
  3207. to created within a DB-TALK application under program
  3208. control. DB-TALK provides for full control on the
  3209. presentation and document layout.
  3210.  
  3211. In addition, DB-TALK provides a report writer which
  3212. can be used to simplify report writing . The report
  3213. writer can be used for columnar reports that produce
  3214. totals. Up to two levels of grouping can be handled.
  3215.  
  3216. @@ OPEN
  3217.  
  3218. OPEN
  3219.  
  3220. Purpose
  3221.  
  3222. Creates a new WP document. An standard template
  3223. (Manuscript only) can be used to provide global
  3224. settings. In the case of 1-2-3, the column and row
  3225. indicators are set to 1.
  3226.  
  3227. Syntax
  3228.  
  3229. oWpDoc = ADLClass ('WP' {cWpType, cDocFile, cTemplate}
  3230. )
  3231. ....
  3232. oWpDoc:Send ('Open')
  3233.  
  3234. Comments
  3235.  
  3236. oWpDoc is the WP object created. cWPType is an
  3237. identifier of document format. Accepted values are :
  3238.  
  3239. 'WP'  - Word Perfect
  3240. 'MS'  - Lotus Manuscript
  3241. '123' - Lotus 1-2-3
  3242. cDocFile is the document file name and cTemplate is an
  3243. existing WP document file which will be used as the
  3244. template document.
  3245.  
  3246. Example
  3247.  
  3248.      oLaserWp = ADLClass ('WP', {'WP', 'laser.wp5', ''} )
  3249.  
  3250.      oLaserWp:Send('Open')
  3251.  
  3252. @@ ADD
  3253.  
  3254. ADD
  3255.  
  3256. Purpose
  3257.  
  3258. Writes a block of text to the WP document object. In
  3259. the case of 1-2-3, cText can be of any type and is
  3260. written to the current cell. The column indicator is
  3261. then advanced.
  3262.  
  3263. Syntax
  3264.  
  3265. oWpDoc:Send ('Add', cText, [nRow, nCol])
  3266.  
  3267. Comments
  3268.  
  3269. oWpDoc is the WP object created. cText is the text to
  3270. be added. For Lotus 1-2-3, nRow and nCol are the new
  3271. row and column positions.
  3272.  
  3273. Example
  3274.  
  3275.      oLaserWp:Send('Add', 'This is a smaple text')
  3276.  
  3277. @@ ADDLINE
  3278.  
  3279. ADDLINE
  3280.  
  3281. Purpose
  3282.  
  3283. Writes a complete paragraph to the WP document object.
  3284. In the case of 1-2-3, cText can be of any type and the
  3285. value is put into the current cell. The row indicator
  3286. is advanced and the column indicator is set to 1.
  3287.  
  3288. Syntax
  3289.  
  3290. oWpDoc:Send ('AddLine', cText)
  3291.  
  3292. Comments
  3293.  
  3294. oWpDoc is the WP object created. cText is the text to
  3295. be added.
  3296.  
  3297. Example
  3298.  
  3299.      TEXT intro
  3300.      .....
  3301.      oLaserWp:Send('AddLine', intro)
  3302.  
  3303. @@ NEWPAGE
  3304.  
  3305. NEWPAGE
  3306.  
  3307. Purpose
  3308.  
  3309. Inserts a new page formatting code into the WP
  3310. document
  3311.  
  3312. Syntax
  3313.  
  3314. oWpDoc:Send ('NewPage')
  3315.  
  3316. Comments
  3317.  
  3318. oWpDoc is the WP object created.
  3319.  
  3320. Example
  3321.  
  3322.      oLaserWp:Send('NewPage')
  3323.  
  3324. @@ CLOSE
  3325.  
  3326. CLOSE
  3327.  
  3328. Purpose
  3329.  
  3330. Closes the WP document
  3331.  
  3332. Syntax
  3333.  
  3334. oWpDoc:Send ('Close')
  3335.  
  3336. Comments
  3337.  
  3338. oWpDoc is the WP object created.
  3339.  
  3340. Example
  3341.  
  3342.      oLaserWp:Send('Close')
  3343.  
  3344. @@ INITIATE
  3345.  
  3346. INITIATE
  3347.  
  3348. Purpose
  3349.  
  3350. To start a report generation. Print headings and
  3351. initialise totals.
  3352.  
  3353. Syntax
  3354.  
  3355. oRep = ADLClass ('REP', {nReport, oDevice, cHeading} )
  3356. oRep:Send ('Initiate')
  3357.  
  3358. Comments
  3359.  
  3360. oRep is the REP object created. nReport is a report
  3361. resource. oDevice is a WP document object or any other
  3362. object that will respond to 'Open', 'Add', 'Addline'
  3363. and 'Close' messages. cHeading is an optional heading
  3364. text.
  3365.  
  3366. Example
  3367.  
  3368.      REPORT samplerep
  3369.      .....
  3370.      oWpDoc = ADLClass ('WP', {'WP', 'laser.wp5', ''} )
  3371.      oRep   = ADLClass ('REP', {samlerep, oWpDoc, ''} )
  3372.  
  3373.      oWpDoc:Send('Open')
  3374.      oRep:Send ('Initiate')
  3375.  
  3376. @@ GENERATE
  3377.  
  3378. GENERATE
  3379.  
  3380. Purpose
  3381.  
  3382. To generate a detail line from a report. Total lines
  3383. if applicable will be produced as well.
  3384.  
  3385. Syntax
  3386.  
  3387. oRep:Send ('Generate')
  3388.  
  3389. Comments
  3390.  
  3391. oRep is the REP object created.
  3392.  
  3393. Example
  3394.  
  3395.      REPORT samplerep
  3396.      .....
  3397.      oWpDoc = ADLClass ('WP', {'WP', 'laser.wp5', ''} )
  3398.      oRep   = ADLClass ('REP', {samlerep, oWpDoc, ''} )
  3399.  
  3400.      oWpDoc:Send('Open')
  3401.      oRep:Send ('Initiate')
  3402.      oDbView:Send('GoTop', 'TEST')
  3403.  
  3404.      DO WHILE ! oDbView:Send('Eof', 'TEST')
  3405.         oRep:Send ('generate')
  3406.  
  3407. @@ TERMINATE
  3408.  
  3409. TERMINATE
  3410.  
  3411. Purpose
  3412.  
  3413. To finish a report. The grand total line if applicable
  3414. will be produced as well.
  3415.  
  3416. Syntax
  3417.  
  3418. oRep:Send ('Terminate')
  3419.  
  3420. Comments
  3421.  
  3422. oRep is the REP object created.
  3423.  
  3424. Example
  3425.  
  3426.      REPORT samplerep
  3427.      .....
  3428.      oWpDoc = ADLClass ('WP', {'WP', 'laser.wp5', ''} )
  3429.      oRep   = ADLClass ('REP', {samlerep, oWpDoc, ''} )
  3430.  
  3431.      oWpDoc:Send('Open')
  3432.      oRep:Send ('Initiate')
  3433.      oDbView:Send('GoTop', 'TEST')
  3434.  
  3435.      DO WHILE ! oDbView:Send('Eof', 'TEST')
  3436.         oRep:Send ('generate')
  3437.         oDbView:Send('Skip', 'TEST', 1)
  3438.      ENDDO
  3439.  
  3440.      oRep:Send ('Terminate')
  3441.      oWpDoc:Send('Close')
  3442.  
  3443. @@Charting
  3444.  
  3445. Charting
  3446.  
  3447. DB-TALK provides a simple means of producing line
  3448. charts, 2D bar charts and 3D bar charts. In addition,
  3449. hard-copies of the chart can be produced for insertion
  3450. into a WP document through Lotus PIC files which can
  3451. be read by both the supported Word Perfect and Lotus
  3452. Manuscript formats.
  3453.  
  3454. LINECHART
  3455.  
  3456. Purpose
  3457.  
  3458. Produces a line chart.
  3459.  
  3460. Syntax
  3461.  
  3462. oChart = ADLClass ('CHT' {aChart, cTitle, bValues,
  3463. aXaxis} )
  3464. ....
  3465. oChart:Send ('LineChart', [cPicFile])
  3466.  
  3467. Comments
  3468.  
  3469. oChart is the CHT object created. aChart is a SCN
  3470. button control array which defines the screen control
  3471. to which the chart is associated. cTitle is the title
  3472. of the chart. bValues is codeblock that returns an
  3473. array containing the values to be plotted. aXaxis is
  3474. an array of labels for the xaxis. cPicfile is an
  3475. optional and is the name of the PIC file to be
  3476. generated from the chart. If omitted, no PIC file will
  3477. be produced.
  3478.  
  3479. Example
  3480.  
  3481.      EXTERNAL Chart
  3482.  
  3483.      FUNCTION Main
  3484.      PRIVATE bValues:={|| aPlotValues}
  3485.      PRIVATE aXaxis = {'One', 'Two', 'Three'}
  3486.      ....
  3487.      aChart = oScrn:Send('Attributes', 15)
  3488.      aPlotvalues = {1,2,3}
  3489.  
  3490.      oChart = ADLClass ('CHT' {aChart, 'Sample Plot',
  3491.      bValues, aXaxis} )
  3492.      ....
  3493.      oChart:Send ('LineChart', 'line.pic')
  3494.  
  3495. @@ 2DCHART
  3496.  
  3497. 2DCHART
  3498.  
  3499. Purpose
  3500.  
  3501. Produces a 2D bar chart.
  3502.  
  3503. Syntax
  3504.  
  3505. oChart:Send ('2DChart', [cPicFile])
  3506.  
  3507. Comments
  3508.  
  3509. oChart is the CHT object created. cPicfile is an
  3510. optional and is the name of the PIC file to be
  3511. generated from the chart. If omitted, no PIC file will
  3512. be produced.
  3513.  
  3514. Example
  3515.  
  3516.      EXTERNAL Chart
  3517.  
  3518.      FUNCTION Main
  3519.      PRIVATE bValues:={|| aPlotValues}
  3520.      PRIVATE aXaxis = {'One', 'Two', 'Three'}
  3521.      ....
  3522.      aChart = oScrn:Send('Attributes', 15)
  3523.      aPlotvalues = {1,2,3}
  3524.  
  3525.      oChart = ADLClass ('CHT' {aChart, 'Sample Plot',
  3526.      bValues, aXaxis} )
  3527.      ....
  3528.      oChart:Send ('2DChart', '2dchart.pic')
  3529.  
  3530. @@ 3DCHART
  3531.  
  3532. 3DCHART
  3533.  
  3534. Purpose
  3535.  
  3536. Produces a 3D bar chart.
  3537.  
  3538. Syntax
  3539.  
  3540. oChart:Send ('3DChart', [cPicFile])
  3541.  
  3542. Comments
  3543.  
  3544. oChart is the CHT object created. cPicfile is an
  3545. optional and is the name of the PIC file to be
  3546. generated from the chart. If omitted, no PIC file will
  3547. be produced.
  3548.  
  3549. Example
  3550.  
  3551.      EXTERNAL Chart
  3552.  
  3553.      FUNCTION Main
  3554.      PRIVATE bValues:={|| aPlotValues}
  3555.      PRIVATE aXaxis = {'One', 'Two', 'Three'}
  3556.      ....
  3557.      aChart = oScrn:Send('Attributes', 15)
  3558.      aPlotvalues = {1,2,3}
  3559.  
  3560.      oChart = ADLClass ('CHT' {aChart, 'Sample Plot',
  3561.      bValues, aXaxis} )
  3562.      ....
  3563.      oChart:Send ('3DChart', '2dchart.pic')
  3564.  
  3565. @@SCRNEDIT
  3566.  
  3567. SCRNEDIT - The Screen Editor
  3568.  
  3569. To edit a screen, type
  3570.  
  3571. SCRNEDIT <file name>
  3572.  
  3573. at the DOS prompt.
  3574.  
  3575. File menu
  3576.  
  3577. OPEN : Select screen file to edit
  3578.  
  3579. SAVE : Enter File name of current screen (NO
  3580. extension)
  3581.  
  3582. NEW :  Clears the current screen design
  3583.  
  3584. IMPORT : Append a reuseable screen file to the
  3585.           current screen design
  3586.  
  3587. GENERATE : Creates a .PIC file from the current screen
  3588.  
  3589. Edit Menu
  3590.  
  3591. CLEAR ALL : Removes all drawn objects
  3592.  
  3593. UNDRAW : Remove last drawn object
  3594.  
  3595. REFRESH : Redraw screen
  3596.  
  3597. TEST MODE : Make buttons active to test Event number
  3598. (ESC terminates)
  3599.  
  3600. EDIT MODE : Select object by clicking on it with left
  3601. button or TAB/SHIFT TAB  keys.
  3602.  
  3603. To select an object in edit mode click on the object
  3604. directly, however if it is already overlapped by a
  3605. bigger object, then that object will always be
  3606. selected. Use the TAB/SHIFT TAB keys to select next
  3607. and previous objects.
  3608.  
  3609. DEL key removes a selected object.
  3610.  
  3611. To copy a screen object in EDIT mode press INS key.
  3612.  
  3613. Use CNTRL key while holding down left  mouse btton to
  3614. drag object to new position.
  3615.  
  3616. Right button click on selected  object will bring up
  3617. properties dialog box. Any of the 12 values can be
  3618. modified by clicking directly on value.
  3619.  
  3620. Frames
  3621.  
  3622. RAISED FRAME : Hold down left mouse button and drag
  3623. botton right corner to  desired position for raised
  3624. frame.
  3625.  
  3626. SUKEN FRAME : Just like raised frame.
  3627.  
  3628. Buttons
  3629.  
  3630. Just like frames use mouse to position and size
  3631. button. Enter button label and   the event number for
  3632. the button. For Radio/Check boxes, enter bit field
  3633. name  and bit number.
  3634.  
  3635. Fields
  3636.  
  3637. USE DATABASE : Select DBF file for field names.
  3638.  
  3639. FIELDS : Draw field like buttons/frames and enter
  3640. field name and optional  picture. Data Entry fields
  3641. are supported in four display types. An optional
  3642. picture clause can be specified. They are
  3643. automatically snapped onto an invisible 27 by 80 grid
  3644. for VGA text font redefinition support.
  3645.  
  3646. Draw
  3647.  
  3648. Draw Lines, rectangles, filled rectangles, Circles
  3649. Icons, Text, Bitmaps and  Vector images. Vector files
  3650. in 'VEC' format are supported. A separate utility
  3651. 'HPTOVEC' is provided to convert a HP plot file into
  3652. VEC format. Another utility ICO2ICN can be used to
  3653. convert any WINDOWS icon into DBTALK format.
  3654.  
  3655. Colors
  3656.  
  3657. TEXT : Current text foreground color
  3658.  
  3659. TEXT BK : Current text background color
  3660.  
  3661. DRAWING : Current color for draw objects.
  3662.  
  3663. BUTTON : Current button color
  3664.  
  3665. SCREEN : Screen backgound color (not saved in screen
  3666. file) PALETTE : Select a VGA palatte file (not saved
  3667. in screen file) FONT : Select a FONT file (not saved
  3668. in screen file)
  3669.  
  3670. Fonts & VGA palettes can be previewed with the screens
  3671. that will use them.
  3672.  
  3673. @@DBU Tool
  3674.  
  3675. DBU The Database Utility
  3676.  
  3677. DBU is supplied with DB-TALK as a tool for maintaing a
  3678. database view resource.
  3679.  
  3680. The main screen shows up to six columns, each of which
  3681. represents a select area.  One unused column is
  3682. visible unless all six are being used.  Each active
  3683. column contains the name of a data file, a list of
  3684. open index files, and an active fields list.  The
  3685. items on this screen together with relations and
  3686. filters make up the current View which affects all
  3687. system operations. The View can be saved in a disk
  3688. file and restored at a later time.
  3689.  
  3690. Help is provided by pressing the F1 key.
  3691.  
  3692. @@TOOLS
  3693.  
  3694. In addition to SCRNEDIT and DBU a number of other
  3695. resource tools are provided.
  3696.  
  3697. ICON
  3698.  
  3699. This is the icon editor. To edit an icon type :
  3700.  
  3701.    ICON [icn file]
  3702.  
  3703. If the icon file is omitted, a blank screen is
  3704. presented.
  3705.  
  3706. FONT
  3707.  
  3708. This is the font editor. To edit a font type :
  3709.  
  3710.    FONT [fnt file]
  3711.  
  3712. If the font file is omitted, a blank screen is
  3713. presented.
  3714.  
  3715. ICO2ICN
  3716.  
  3717. This utility will convert WINDOWS 'ICO' files into
  3718. Gforce 'ICN' format for use by DBTALK programs. Use
  3719. as:
  3720.  
  3721.    ICO2ICN <ico file spec>
  3722.  
  3723. For example to convert all ico files in directory test
  3724. to icn type ICO2ICN *.ico
  3725.  
  3726. HPTOVEC
  3727.  
  3728. This utility will convert HP plot files into VEC
  3729. vector format for use by the screen editor. Use as:
  3730.  
  3731.    HPTOVEC <HP plot file>
  3732.  
  3733. @@Functions
  3734.  
  3735. Clipper Functions
  3736.  
  3737. DB-TALK is written in Clipper and relies heavily on
  3738. the excellent Clipper run-time engine to be able to
  3739. interpret its own functions which call the basic
  3740. Clipper primitive functions. To keep the run time
  3741. engine compact only Clipper functions used by DB-TALK
  3742. can be accessed.
  3743.  
  3744. The documentation of these Clipper functions is beyond
  3745. the scope of this guide. A good book to read is the
  3746. CLIPPER Programmer's reference by W. Edward Tiley. It
  3747. has everything you may wish to know about CLIPPER
  3748. normal functions you may freely use and the primitives
  3749. which you are advised not to use. The ones accessible
  3750. from DB-TALK are referenced below.
  3751.  
  3752. @@ Arrays
  3753.  
  3754. Arrays
  3755.  
  3756. DB-TALK supports the new multi-dimension array data
  3757. structure of Clipper 5. Calling this data structure an
  3758. array is a misnomer. It is in-fact powerful list
  3759. structure which can be used to represent almost any
  3760. type of data structure required.
  3761.  
  3762. AADD
  3763.  
  3764. To add new elements to an array
  3765.  
  3766. aadd (aArray, xExpr)
  3767.  
  3768. ACOPY
  3769.  
  3770. To copy the elements of one array into another array
  3771.  
  3772. acopy (aSource, aTarget, [nStart], [nCount],
  3773. [nTargetPos])
  3774.  
  3775. ADEL
  3776.  
  3777. To delete any single element from an array
  3778.  
  3779. adel (aTarget, nPos)
  3780.  
  3781. DIRECTORY
  3782.  
  3783. To create an array that contains the directory
  3784. information of a specification of files and file
  3785. attributes
  3786.  
  3787. aArray = directory (cDirSpec, cAttributes)
  3788.  
  3789. AEVAL
  3790.  
  3791. To navigate an array evaluating a code block on each
  3792. element found.
  3793.  
  3794. aeval (aArray, bBlock, [nStart, nCount])
  3795.  
  3796. AFILL
  3797.  
  3798. To fill selected elements of ann array with a
  3799. specified value
  3800.  
  3801. afill (aTarget, xExpr, [nStart, nCount])
  3802.  
  3803. AINS
  3804.  
  3805. To insert an element into an array at a specified
  3806. location. All other elements are pushed forward
  3807.  
  3808. ains (aTargetm nPos)
  3809.  
  3810. ARRAY
  3811.  
  3812. To create an array.
  3813.  
  3814. aArray = array (aLength)
  3815.  
  3816. ASCAN
  3817.  
  3818. To search an array for the first element that matches
  3819. an expression.
  3820.  
  3821. ascan (aTarget, xExpr, [nStart, nCount])
  3822.  
  3823. ASIZE
  3824.  
  3825. To re-size an array after creation.
  3826.  
  3827. asize (aTarget, nLength)
  3828.  
  3829. ASKIP
  3830.  
  3831. To navigate an array and return the actual number of
  3832. elements skipped.
  3833.  
  3834. nSkip = askip (aArray, nElemetPos, nSkip)
  3835.  
  3836. ASORT
  3837.  
  3838. To sort selected elements of an array in ascending
  3839. order.
  3840.  
  3841. asort (aTarget, [nStart], [nCount])
  3842.  
  3843. LEN
  3844.  
  3845. To determine the number of elements in an array
  3846.  
  3847. nSize = len (aArray)
  3848.  
  3849. @@ DOS Files
  3850.  
  3851. DOS Files
  3852.  
  3853. One of the strength's of Clipper is that it provides
  3854. basic functions to manipulate any type of DOS file.
  3855. DB-TALK provides additional support by providing
  3856. functions to read and write lines of ASCII text files.
  3857.  
  3858. FREADLN
  3859.  
  3860. To read an ASCII text line
  3861.  
  3862. lEof_flag = freadln ( nHandle, @cBuffer, nMax_line)
  3863.  
  3864. WRITELN
  3865.  
  3866. To write an ASCII text line
  3867.  
  3868. fwriteln ( nHandle, cBuffer)
  3869.  
  3870. FCLOSE
  3871.  
  3872. To close a DOS file
  3873.  
  3874. fclose ( nHandle)
  3875.  
  3876. FCREATE
  3877.  
  3878. To create a DOS file
  3879.  
  3880. nHandle = fcreate ( cFileName, nAttribute)
  3881.  
  3882. FERROR
  3883.  
  3884. To determine what errors have occured by a low-level
  3885. DOS file funnction
  3886.  
  3887. nErrorNumber = ferror ()
  3888.  
  3889. FILE
  3890.  
  3891. To determine the existence what errors have occured by
  3892. a low-level DOS file funnction
  3893.  
  3894. nErrorNumber = ferror ()
  3895.  
  3896. FOPEN
  3897.  
  3898. To open a DOS file
  3899.  
  3900. nHandle = fopen ( cFileName, nAttribute)
  3901.  
  3902. FREAD
  3903.  
  3904. To read a number of bytes from an opened DOS file
  3905.  
  3906. nBytes_read = fread ( nHandle, @cBuffer, nBytes)
  3907.  
  3908. FRENAME
  3909.  
  3910. To rename a DOS file name
  3911.  
  3912. FreName (cOldName, cNewName)
  3913.  
  3914. FSEEK
  3915.  
  3916. To position the DOS file pointer
  3917.  
  3918. fseek ( nHandle, nOffset, [nStartIndicator]))
  3919.  
  3920. FWRITE
  3921.  
  3922. To write a number of bytes to an opened DOS file
  3923.  
  3924. fwrite ( nHandle, cBuffer, nBytes)
  3925.  
  3926. @@ Environment
  3927.  
  3928. Environment
  3929.  
  3930. Clipper uses a number of environmental functions to
  3931. control its behaviour and to provide memory, keyboard,
  3932. screen and file services. DB-TALK allows access to
  3933. these functions and provides further functions to
  3934. service DB-TALK objects.
  3935.  
  3936. QOUT
  3937.  
  3938. To display data on the current display device with a
  3939. line feed.
  3940.  
  3941. qout (xExpr)
  3942.  
  3943. QQOUT
  3944.  
  3945. To display data on the current display device without
  3946. a line feed.
  3947.  
  3948. qqout (xExpr)
  3949.  
  3950. QUIT
  3951.  
  3952. To return back to DOS after closing all open files
  3953.  
  3954. quit ()
  3955.  
  3956. KEYBOARD
  3957.  
  3958. To clear out or stuff the 'type-ahead' keyboard buffer
  3959. with character.
  3960.  
  3961. keyboard ([cTypeAheadCharacters])
  3962.  
  3963. KILL
  3964.  
  3965. To remove a PUBLIC variable from memory
  3966.  
  3967. kill (cVarName)
  3968.  
  3969. SET
  3970.  
  3971. To determine the status of or change the status of
  3972. various CLIPPER environment control variables.
  3973.  
  3974. set (nSelection, xNewsetting, [cFileName])
  3975.  
  3976. COL
  3977.  
  3978. To return the current screen column position
  3979.  
  3980. nColumn = col()
  3981.  
  3982. CURDIR
  3983.  
  3984. To determine the current DOS directory
  3985.  
  3986. cDir = curdir(cDiskDrive)
  3987.  
  3988. DISKSPACE
  3989.  
  3990. To determine the amount of disk space left on disk
  3991.  
  3992. nSpaceLeft = diskspace (nDriveNumber)
  3993.  
  3994. DOSERROR
  3995.  
  3996. To determine if any program action has caused a DOS
  3997. error
  3998.  
  3999. nErrorCode = doserror()
  4000.  
  4001. ERRORLEVEL
  4002.  
  4003. To determine or set the DOS errorlevel
  4004.  
  4005. nErrorLevel = errorlevel ([nNewErrorLevel])
  4006.  
  4007. GETE
  4008.  
  4009. To import the contents of a DOS environment variable
  4010.  
  4011. cExpr = getenv (cVarName)
  4012.  
  4013. INKEYWAIT
  4014.  
  4015. To obtain the next keystroke.
  4016.  
  4017. cCharacter = inkeywait (nNoSecs)
  4018.  
  4019. LASTKEY
  4020.  
  4021. To determine the last keystroke.
  4022.  
  4023. cCharacter = lastkey ()
  4024.  
  4025. MEMORY
  4026.  
  4027. To determine the amount of memory left
  4028.  
  4029. nBytesLeft = memory (nTypeQuery)
  4030.  
  4031. NEXTKEY
  4032.  
  4033. To inspect the keyboard buffer to determine the next
  4034. keystroke.
  4035.  
  4036. cCharacter = nextkey()
  4037.  
  4038. SETCANCEL
  4039.  
  4040. To determine or inhibit the use of ALT-C as a means of
  4041. terminating an application
  4042.  
  4043. lCurrentStatus = setcancel ([lNewStatus])
  4044.  
  4045. SETCOLOR
  4046.  
  4047. To determine the current color setting or define new
  4048. setting
  4049.  
  4050. cCurrentColor = setcolor ([cNewColor])
  4051.  
  4052. SETCURSOR
  4053.  
  4054. To determine the current cursor shape or define a new
  4055. shape
  4056.  
  4057. cCurrentShape = setcursor ([cNewShape])
  4058.  
  4059. SETKEY
  4060.  
  4061. To determine the current hotkey action or determine a
  4062. new action.
  4063.  
  4064. bCurrentAction = setkey ([nInkeyval], [bNewAction])
  4065.  
  4066. SETMODE
  4067.  
  4068. To change the display mode on an EGA/VGA display
  4069. adaptor.
  4070.  
  4071. lFlag = setmode (nRows, nCols)
  4072.  
  4073. SETTRACE
  4074.  
  4075. To put the DB-TALK trace mode on.
  4076.  
  4077. lOldstatus = settrace (lNewStatus)
  4078.  
  4079. TONE
  4080.  
  4081. To sound the PC speaker
  4082.  
  4083. tone (nFreq, nDuration)
  4084.  
  4085. @@ Numeric
  4086.  
  4087. Numeric Functions
  4088.  
  4089. In addition to the basic numeric operators, the
  4090. following Clipper numeric functions can be used to
  4091. provide further extend DB-TALK's computational
  4092. capabilities.
  4093.  
  4094. ABS
  4095.  
  4096. Absolute value of a numeric expression
  4097.  
  4098. nVal = abs (nExpr)
  4099.  
  4100. EXP
  4101.  
  4102. Derive natural antilogrithm of a number
  4103.  
  4104. nVal = exp (nExpr)
  4105.  
  4106. INT
  4107.  
  4108. Derive integer value of a number
  4109.  
  4110. nVal = int (nExpr)
  4111.  
  4112. LOG
  4113.  
  4114. Derive natural log of a number
  4115.  
  4116. nVal = log (nExpr)
  4117.  
  4118. MAX
  4119.  
  4120. Determine the greater of two values
  4121.  
  4122. lFlag = max (xEpr1, xExpr2)
  4123.  
  4124. MIN
  4125.  
  4126. Determine the smaller of two values
  4127.  
  4128. lFlag = max (xEpr1, xExpr2)
  4129.  
  4130. ROUND
  4131.  
  4132. Round a value up to a specific decimal precision
  4133.  
  4134. nVal = round (nExpr)
  4135.  
  4136. SQRT
  4137.  
  4138. Derive the square root of a number
  4139.  
  4140. nVal = sqrt (nExpr)
  4141.  
  4142. @@ String
  4143.  
  4144. String
  4145.  
  4146. In addition to the basic string operators, the
  4147. following Clipper string functions can be used to
  4148. further extend DB-TALK's text processing capabilities.
  4149.  
  4150. AT
  4151.  
  4152. Establish where a substring begins in a string
  4153.  
  4154. nPosition = at (cSubString, cString)
  4155.  
  4156. ALLTRIM
  4157.  
  4158. Remove leading and trailing spaces from a string
  4159.  
  4160. cVal = alltrim (cExpr)
  4161.  
  4162. LEFT
  4163.  
  4164. Extract a substring from a string starting from the
  4165. left
  4166.  
  4167. cVal = left (cExpr, nNoChars)
  4168.  
  4169. LEN
  4170.  
  4171. Establish how long a string is
  4172.  
  4173. nStringLength = len (cExpr)
  4174.  
  4175. LOWER
  4176.  
  4177. Translate all characters into lowercase
  4178.  
  4179. cVal = lower(cExpr)
  4180.  
  4181. LTRIM
  4182.  
  4183. Remove leading spaces from a string
  4184.  
  4185. cVal = ltrim (cExpr)
  4186.  
  4187. MEMOEDIT
  4188.  
  4189. Edit a string variable with a screen editor
  4190.  
  4191. cVal = memoedit(nTop, nLeft, nBot, nRight,
  4192. lEditMode,cUdf,nLineLen,nTabsize)
  4193.  
  4194. MEMOLINE
  4195.  
  4196. To extract and format text lines from a string/memo
  4197. variable
  4198.  
  4199. cVal = memoline (cString, nLinelen, nLineNo, nTabSize,
  4200. lWrap)
  4201.  
  4202. MEMOREAD
  4203.  
  4204. Read an ASCII file from disk into a string variable
  4205.  
  4206. cVal = memoread (cFileName)
  4207.  
  4208. MEMOTRAN
  4209.  
  4210. Translate hard returns and soft returns into alternate
  4211. characters
  4212.  
  4213. cVal = memotran (cString, cHardChar, cSoftChar)
  4214.  
  4215. MEMOWRIT
  4216.  
  4217. Create an ASCII file on disk from  a string variable
  4218.  
  4219. lFlag = memowrit (cFileName, cString)
  4220.  
  4221. MLCOUNT
  4222.  
  4223. Establish how many formatted text lines are in a
  4224. string/memo variable
  4225.  
  4226. nLines = mlcount (cString, nLinelen, nTabSize, lWrap)
  4227.  
  4228. MLPOS
  4229.  
  4230. Establish absolute position within a formatted string
  4231. of a line position
  4232.  
  4233. nNoChars = mlpos (cString, nLinelen, nLineNumber,
  4234. nTabSize, lWrap)
  4235.  
  4236. PAD PADL PADR
  4237.  
  4238. Pad a string variable with spaces.
  4239.  
  4240. cVal = pad (cString, nLength, cPadChar)
  4241.  
  4242. RAT
  4243.  
  4244. Establish where a substring begins in a string from
  4245. the rear
  4246.  
  4247. nPosition = rat (cSubString, cString)
  4248.  
  4249. REPLICATE
  4250.  
  4251. Repeat a character string many times
  4252.  
  4253. cVal = replicate (cString, nNoTimes)
  4254.  
  4255. RIGHT
  4256.  
  4257. Extract a substring from a string starting from the
  4258. rear
  4259.  
  4260. cVal = right (cExpr, nNoChars)
  4261.  
  4262. SPACE
  4263.  
  4264. Pad a string value with spaces
  4265.  
  4266. cVal = space (nSize)
  4267.  
  4268. STRTRAN
  4269.  
  4270. Search and replace of substrings within strings
  4271.  
  4272. cVal = strtran (cString, cSearch, cReplace, nStart,
  4273. nCount)
  4274.  
  4275. STUFF
  4276.  
  4277. Insert, modify and delete characters within a string
  4278.  
  4279. cVal = stuff (cString, nStart, nDelete, cInsert)
  4280.  
  4281. SUBSTR
  4282.  
  4283. Extract a substring from a string starting from any
  4284. point
  4285.  
  4286. cVal = substr (cExpr, nStart, [nNoChars])
  4287.  
  4288. TRIM
  4289.  
  4290. Remove trailing spaces from a string
  4291.  
  4292. cVal = trim (cExpr)
  4293.  
  4294. UPPER
  4295.  
  4296. Translate all characters into uppercase
  4297.  
  4298. cVal = upper(cExpr)
  4299.  
  4300. @@ Date
  4301.  
  4302. Date
  4303.  
  4304. In addition to the basic date operators, the following
  4305. Clipper date functions can be used to further extend
  4306. DB-TALK's date processing capabilities.
  4307.  
  4308. CDOW
  4309.  
  4310. Return name of day in week from a date
  4311.  
  4312. cDay = cdow (dExpr)
  4313.  
  4314. CMONTH
  4315.  
  4316. Return name of month from a date
  4317.  
  4318. cMonth = cmonth (dExpr)
  4319.  
  4320. DATE
  4321.  
  4322. Return system date
  4323.  
  4324. dCurrentDate = date()
  4325.  
  4326. DAY
  4327.  
  4328. Obtain day of month from a date
  4329.  
  4330. nDay = day (dExpr)
  4331.  
  4332. DOW
  4333.  
  4334. Obtain day of week from a date
  4335.  
  4336. nDay = dow (dExpr)
  4337.  
  4338. MONTH
  4339.  
  4340. Obtain day of month from a date
  4341.  
  4342. nDay = dow (dExpr)
  4343.  
  4344. SECONDS
  4345.  
  4346. Obtain no of seconds past since midnight
  4347.  
  4348. nSecs = seconds ()
  4349.  
  4350. TIME
  4351.  
  4352. Obtain current time
  4353.  
  4354. cTime = time()
  4355.  
  4356. YEAR
  4357.  
  4358. Obtain 4 digit year from a date
  4359.  
  4360. nYear = year (dExpr)
  4361.  
  4362. @@ Logical
  4363.  
  4364. Logical
  4365.  
  4366. In addition to the basic logical operators, the
  4367. following Clipper logical functions can be used to
  4368. further extend DB-TALK's logic processing
  4369. capabilities.
  4370.  
  4371. EMPTY
  4372.  
  4373. Confirm a variable does have a value of any type
  4374.  
  4375. lFlag = empty (xEpr)
  4376.  
  4377. IF/IIF
  4378.  
  4379. Achieve conditional assignment
  4380.  
  4381. xVal = iif (lCondition xTrueExpr, xFalseExpr)
  4382.  
  4383. ISALPHA
  4384.  
  4385. Determine if first characater of a string is aphabetic
  4386.  
  4387. lFlag = isalpha (cExpr)
  4388.  
  4389. ISCOLOR
  4390.  
  4391. Determine if computer can display colors
  4392.  
  4393. lFlag = iscolor ()
  4394.  
  4395. ISLOWER
  4396.  
  4397. Determine if first characater of a string is lowercase
  4398.  
  4399. lFlag = islower (cExpr)
  4400.  
  4401. ISPRINTER
  4402.  
  4403. Determine if printer is ready
  4404.  
  4405. lFlag = isprinter ()
  4406.  
  4407. ISUPPER
  4408.  
  4409. Determine if first characater of a string is uppercase
  4410.  
  4411. lFlag = isupper (cExpr)
  4412.  
  4413. @@ Conversions
  4414.  
  4415. Conversions
  4416.  
  4417. DB-TALK allows direct access to Clipper data type
  4418. conversion functions. The functions are as follows :
  4419.  
  4420. ASC
  4421.  
  4422. First character to ASCII
  4423.  
  4424. nAsciiVal = asc (cExpr)
  4425.  
  4426. BIN2I
  4427.  
  4428. 16-bit signed to integer
  4429.  
  4430. nVal = bin2i (cSignedInt)
  4431.  
  4432. BIN2L
  4433.  
  4434. 32-bit signed to integer
  4435.  
  4436. nVal = bin2l (cSignedInt)
  4437.  
  4438. BIN2W
  4439.  
  4440. 64-bit signed to integer
  4441.  
  4442. nVal = bin2w (cSignedInt)
  4443.  
  4444. CHR
  4445.  
  4446. ASCII to single character
  4447.  
  4448. cCharacter = chr (nAsciiVal)
  4449.  
  4450. CTOD
  4451.  
  4452. Character to Date
  4453.  
  4454. dVal = ctod (cExpr)
  4455.  
  4456. DTOC
  4457.  
  4458. Date to Character
  4459.  
  4460. cVal = dtoc (dExpr)
  4461.  
  4462. DTOS
  4463.  
  4464. Date to Character (sort format)
  4465.  
  4466. cVal = dtos (dExpr)
  4467.  
  4468. I2BIN
  4469.  
  4470. Integer to 16-bit signed
  4471.  
  4472. cSignedInt = i2bin (nVal)
  4473.  
  4474. L2BIN
  4475.  
  4476. Integer to 32-bit signed
  4477.  
  4478. cSignedInt =l2bin (nVal)
  4479.  
  4480. STR
  4481.  
  4482. Numeric to string
  4483.  
  4484. cString = str (nVal, nNoDigits, nDecimals)
  4485.  
  4486. TRANSFORM
  4487.  
  4488. Convert any value into character using a picture
  4489. specification.
  4490.  
  4491. cString = transform (xExpr, cPictureSpec)
  4492.  
  4493. TYPE
  4494.  
  4495. Determine data type of expression
  4496.  
  4497. cDataType = type (xEpr)
  4498.  
  4499. VAL
  4500.  
  4501. String to Numeric
  4502.  
  4503. nVal = val (cExpr)
  4504.  
  4505. @@Timer
  4506.  
  4507. There is a single event timer that can be used to
  4508. process application logic during wait states. The
  4509. SeTimer (nCycles) function sets the number of times
  4510. the event handler will scan the mouse and keyboard.
  4511. Default is SetTimer(0) which means wait for event. For
  4512. an example, see the screen clock in the demo
  4513. application.
  4514.  
  4515. @@BIT STRING
  4516.  
  4517. Bit String Functions
  4518.  
  4519. To test if a bit is set on
  4520.  
  4521.      lOn = BitTest(cBitString, nPosition)
  4522.  
  4523. To set a bit on
  4524.  
  4525.      cNewString = BitSet(cBitString, nPostion)
  4526.  
  4527. To set a bit off
  4528.  
  4529.      cNewString = BitReset(cBitString, nPosition)
  4530.  
  4531. @@Picture
  4532.  
  4533. PICTURE CODES
  4534.  
  4535. A picture specification consists of  FUNCTION codes,
  4536. PICTURE template codes, or a combination of both.
  4537.  
  4538. If FUNCTION codes are used, they appear first. As many
  4539. FUNCTION codes as desired may be included with no
  4540. embedded spaces.  The last FUNCTION code in the string
  4541. must be followed by one or more spaces.  The space(s)
  4542. signals the end of the FUNCTION codes and the start of
  4543. the PICTURE template codes.  The available FUNCTION
  4544. and PICTURE template codes are listed as follows
  4545.  
  4546. FUNCTION Codes
  4547.  
  4548. A -- Allow alphabetic characters only.
  4549.  
  4550. B -- Left-justify numeric data within the output
  4551. field.
  4552.  
  4553. C -- A CR (credit) is displayed after a positive
  4554. number.  May be used with numeric data only.  May be
  4555. used with the SAY clause only.
  4556.  
  4557. D -- Uses the current SET DATE format (e.g. BRITISH,
  4558. GERMAN, etc.) for editing date type data.
  4559.  
  4560. E -- Edit date type data as a European (BRITISH)
  4561. date.
  4562.  
  4563. K -- Erase current value if first key is not a cursor
  4564. key
  4565.  
  4566. R -- Non-template characters will be displayed but not
  4567. stored in the variable.  May be used with character
  4568. data only.
  4569.  
  4570. S<n> -- Limit display width to <n> characters, where
  4571. <n> is a positive integer.  Horizontally scroll the
  4572. field within the <n> columns specified.  The Right
  4573. Arrow, Left Arrow, Home and End cursor-control keys
  4574. may be used to bring hidden portions of the field into
  4575. view.  May be used with character data only.
  4576.  
  4577. X -- A DB (debit) symbol is displayed after negative
  4578. numbers.  May be used with numeric data only.  May be
  4579. used with the SAY clause only.
  4580.  
  4581. Z -- The field is displayed as all blanks if its
  4582. numeric value is 0.  May be used with numeric data
  4583. only.
  4584.  
  4585. ( -- Negative numbers are enclosed in parentheses when
  4586. this function is used.  May be used with numeric data
  4587. only.  May be used with the SAY clause only.
  4588.  
  4589. ! -- Any character may be entered; however, alphabetic
  4590. characters will be converted to uppercase.  May be
  4591. used with character data only.
  4592.  
  4593. PICTURE Template Codes
  4594.  
  4595. A PICTURE expression may include any desired
  4596. characters; only those characters listed below
  4597. actively participate in editing and data entry.  If
  4598. any other characters are included in the format, they
  4599. appear in output and, for input operations, appear in
  4600. the field as comment information which is skipped over
  4601. by the cursor.
  4602.  
  4603. The characters which may be used within the picture
  4604. expression are described below.
  4605.  
  4606. A -- Allows only alphabetic characters to be entered.
  4607.  
  4608. L -- Allows logical data only.
  4609.  
  4610. N -- Allows letters and digits only.
  4611.  
  4612. X -- Allows any character.
  4613.  
  4614. Y -- Allows logical Y, y, N, n only, converting y and
  4615. n to Y and N respectively.
  4616.  
  4617. 9 -- With character data, allows digits only.  With
  4618. numeric data, allows digits and signs.
  4619.  
  4620. # -- Allows digits, blanks and signs.
  4621.  
  4622. ! -- Converts lowercase letters to uppercase letters.
  4623.  
  4624. * -- Asterisks are displayed in front of the numeric
  4625. value.
  4626.  
  4627. . -- A period specifies the decimal point position.
  4628.  
  4629. , -- A comma may be used to separate digits left of
  4630. the decimal point.
  4631.  
  4632. @@SETS
  4633.  
  4634. SET Function Code values
  4635.  
  4636. The SET function can be used to alter certain default
  4637. parameters in the Clipper run-time engine. Format is :
  4638.  
  4639. xOldValue = SET (nCode, xNewValue)
  4640.  
  4641.  
  4642. nCode  Keyword     Data     Description
  4643.                    Type
  4644.  
  4645.  
  4646. 1      EXACT       Logical  Specify method of
  4647.                             comparing strings
  4648.  
  4649. 2      FIXED       Logical  Integers or decimals
  4650.  
  4651. 3      DECIMALS    Numeric  Fix decimal precision
  4652.  
  4653. 4      DATEFORMAT  Characte American    mm/dd/yy
  4654.                    r        ANSI        yy.mm.dd
  4655.                             British     dd/mm/yy
  4656.                             French      dd/mm/yy
  4657.                             German      dd.mm.yy
  4658.                             Italian     dd-mm-yy
  4659.                             Japan       yy/mm/dd
  4660.                             USA         mm-dd-yy
  4661.  
  4662. 5      EPOCH       Numeric  Set Begining of century
  4663.  
  4664. 6      PATH        Char     List of subdirectories
  4665.                             seperated by semicolons to
  4666.                             be used for reading files
  4667.  
  4668. 7      DEFAULT     Char     Specify directory for
  4669.                             writing files
  4670.  
  4671. 8      EXCLUSIVE   Logical  Set network usage of files
  4672.  
  4673. 9      SOFTSEEK    Logical  Determine whether record
  4674.                             pointer is positioned at
  4675.                             next record or end of file
  4676.                             after a seek failure
  4677.  
  4678. 10     UNIQUE      Logical  Surpress/Access records
  4679.                             with duplicate indexes
  4680.  
  4681. 11     DELETED     Logical  Surpress/Access deleted
  4682.                             records
  4683.  
  4684. 12     CANCEL      Logical  Inhibit/Allow use of ALT C
  4685.                             to terminate DB-TALK
  4686.                             applications
  4687.  
  4688. 13     DEBUG       Logical  Switch on Clipper
  4689.                             debugging
  4690.  
  4691. 14     TYPEAHEAD   Numeric  Fix typeahead buffer size
  4692.  
  4693. 15     COLOR       Char     Set video color
  4694.  
  4695. 16     CURSOR      Logical  Display/Hide cursor
  4696.  
  4697. 17     CONSOLE     Logical  Inhibit/Allow screen
  4698.                             display
  4699.  
  4700. 18     ALTERNATE   Logical  Re-direct screen display
  4701.                             to a file
  4702.  
  4703. 19     ALTFILE     Char     Specify file to be used
  4704.                             for screen re-routing
  4705.  
  4706. 20     DEVICE      Logical  Re-direct screen display
  4707.                             to screen or printer
  4708.  
  4709. 23     PRINTER     Logical  Set printer on for printer
  4710.                             output
  4711.  
  4712. 24     PRINTFILE   Char     Specify file to be used
  4713.                             for printer re-routing
  4714.  
  4715. 25     MARGIN      Numeric  Set left margin for
  4716.                             printer output
  4717.  
  4718. 26     BELL        Logical  Turn on/off speaker during
  4719.                             data entry
  4720.  
  4721. 27     CONFIRM     Logical  Force pressing of return
  4722.                             key to complete each field
  4723.                             data entry
  4724.  
  4725. 28     ESCAPE      Logical  Allow escape key to end
  4726.                             data entry
  4727.  
  4728. 29     INSERT      Logical  Toggle Insert key between
  4729.                             insert and overtype
  4730.  
  4731. 30     EXIT        Logical  Allow cursor keys to end
  4732.                             data entry
  4733.  
  4734. 31     INTENSITY   Logical  Force the same color to be
  4735.                             used for both display and
  4736.                             data entry fileds
  4737.  
  4738. 32     SCOREBOARD  Logical  Inhibit CLIPPER's use of
  4739.                             the top row for status
  4740.                             information
  4741.  
  4742. 33     DELIMITERS  Logical  Allow/disallow use of
  4743.                             delimiters for data entry
  4744.                             fields
  4745.  
  4746. 34     DELIMCHARS  Char     Set delimiter characters
  4747.  
  4748.